I'm trying to figure out how to print any inputted string multiple times in java. This is what I have thus far...
public class Main{
public static String printGivenStringTimesNumberGiven(String str, int n) {
for (int i=0; i<n; i++)
str += n;
return str;
}
//Don't touch here
public static void main(String[] args){
System.out.println(printGivenStringTimesNumberGiven("Ha", 3));
}
}
I keep on getting Ha333 multiple times and I'm not sure where to go from here. Any help would be appreciated. I'm trying to get it to print out HaHaHa.