Java Program to Reverse a String

Write a Java program to reverse a string with an example. We can do this in multiple ways: Java Program to Reverse a String using StringBuilder We use the StringBuilder class to reverse the given string in this example. Here, StringBuilder(revStr) will create a StringBuilder of name sb. The sb.reverse() inside the println() statement calls … Read more