I'm studying Java recently.
Is there any way to make a string from char with N-times?
C#: string str = new string('A', 30);
Java: ???
please help me. Thank you
I'm studying Java recently.
Is there any way to make a string from char with N-times?
C#: string str = new string('A', 30);
Java: ???
please help me. Thank you
 
    
    What version of java are you using?
If Java 8
String.join("", Collections.nCopies(n, s));
If Java 11
"abc".repeat(12);
 
    
    This is one way you could do it using Java 8 Streams.
        String aNTimes = IntStream.range(0, 30)
                .mapToObj(index -> "A")
                .collect(Collectors.joining());
