Tag: Java String Reverse Example

Java String reverse with and without reverse() Example

November 25, 2014 · 1 min read
To reverse a string with less code in Java, there comes **reverse()** method in **StringBuffer** class. **reverse()** method cannot be used directly on string as **reverse()** is not defined in String class but defined in **StringBuffer** and **StringBuilder**. String should be converted to StringBuffer and then applied **reverse()** method. **1. Reversing using reverse() method.**