Write a method named repl that accepts a String and a number of repetitions as parameters and returns the String concatenated that many times. For example, the call repl("hello", 3) returns "hellohellohello". If the number of repetitions is 0 or less, an empty string is returned.
I can only loop 1 time only. May I know what is the problem?
I can only loop 1 time only. May I know what is the problem?
public static String repl (String i, int j){
for (int k = 0; k<j; k++){
}
return i;
}
public static void main (String [] args){
String i = repl ("hello", 3);
}