Java StringBuffer reverse() method

reverse()

replace the string buffer’s character sequence with the reverse character sequence.

Syntax:

public synchronized  StringBuffer reverse()

 

Example

class TestStringBuffer{
    StringBuffer sb = new StringBuffer("www.w3schools.blog");
    
    public void reverseTest(){
        //replace the string buffer’s character 
                //sequence by reverse character sequence.
        System.out.println(sb.reverse());
    }
}

public class StringBufferReverseExample {
    public static void main(String args[]){
        //creating TestStringBuffer object
        TestStringBuffer obj = new TestStringBuffer();
        
        //method call
        obj.reverseTest();
    }
}

Output

moc.063sloohcs3w.www