0
Why am i getting an error method repeat(int) is undefined for the type string
public class Main { public static void main(String[] args) { for (int i=1;i<=5;i++) { System.out.println((Integer.toString((i*2)-1)).repeat(i)); } } }
2 ответов
+ 2
String.repeat() method available since Java 11, you might wanna check your Java installation version.
P.S. Code runs fine in Code Playground.
+ 1
Thanks