242,755 views
20 votes
20 votes
How do I repeat a word in Java for example:

Are you okay?

Yes

Are you really okay?

Yes

Are you really really okay?

Yes

Here I want to repeat the word really in every sentence.

User PointNclick
by
2.8k points

1 Answer

6 votes
6 votes

Answer: repeated = new String(new char[n]). replace("\0", s); Where n is the number of times you want to repeat the string and s is the string to repeat.

Step-by-step explanation:

User Fiza Khan
by
3.0k points