This method undoes the worth of the StringBuffer object that appealed to the technique. Let n be the distance end to end of the old character series, the one hold in the string bumper just prior to the execution of the invalidate method. Then, the personality at index k in the new character chain is equal to the value at index n-k-1 in the old character sequence.
Here is the syntax for this method:
public StringBuffer reverse()
Here is the detail of parameters:
Example
public class Test { public static void main(String args[]) { StringBuffer buffer = new StringBuffer("Intelli Nuts"); buffer.reverse(); System.out.println(buffer); } }
This will produce the following result:
stuN illetnI
Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.