<- Back

How to reverse a string in Java

StringBuilder

var stringToReverse = new StringBuilder("Java"); 
System.out.println(stringToReverse.reverse()); 

Output

"avaJ" 

<- Back