We love static methods. They make the inaccessible accessible. Of course, sometimes the opposite is true... But in this task, we love them: Let's create a StringHelper class that has 2 static methods: multiply(String s, int count) - returns a string that has been repeated count times; and multiply(String s) - returns a string that has been repeated 5 times.
You must be signed in to leave a comment
10 October 2022, 07:28
How do you expect us to do the task if it is not clearly explained and you have to use methods that we have not used yet?
21 October 2021, 06:48
you can use a for loop and "result+=s;"
8 July 2021, 21:19
use a for loop to append onto the result variable
25 February 2021, 14:13
10 August 2020, 12:18
for loop came in handy :)
12 June 2020, 20:11
What's the point of String result = ""; ? Is that just to initialize 'result'? Would it have hurt anything to just write String result; ?
10 April 2020, 04:26
The wording of this task is misleading.
11 January 2020, 18:02
I solved this with the repeat method, ( tested separately ). A simple solution, however, I could not get it to compile with CodeGym.
13 December 2019, 19:41
Actually since Java 11 there is a repeat method in String
8 October 2019, 20:37
Hi lads whats wrong with code ?