I have a problem with a fairly simple question in Java. To repeat a string, you can use str.repeat from Java 11. However I have the following error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method repeat(int) is undefined for the type String
The code is as follows:
String rep = "-";
rep = rep.repeat(4);
System.out.println(rep);
With a command-line compilation, no problem, but Eclipse is problematic, it uses
java-11-openjdk-amd64
Thanks for your help
System.out.println(System.getProperty("java.vm.version"));