Java StringBuffer reverse() method - Causes this character sequence to be replaced by the reverse of the sequence.
Example: Example to reverse the given String "javaguides" using reverse() method.
public class ReverseExample {
public static void main(String[] args) {
StringBuffer buffer = new StringBuffer("javaguides");
StringBuffer reverse = buffer.reverse();
System.out.println("Reversed string :" + reverse);
}
}
Output:
Reversed string :sediugavaj
Comments
Post a Comment