Java StringBuffer Reverse Example

 

The sequence of character contained in the string buffer is replaced by the reverse method(reverse()).String Buffer class is a mutable class means can be changed dynamically.

 

import javax.swing.*;

public class reversedemo

{

public static void main(String args[])

{

StringBuffer d = new StringBuffer(" 1564");

JOptionPane.showMessageDialog(null,d);

d.reverse();

JOptionPane.showMessageDialog(null,d);

System.out.println(d);

}

}

Output...

Reverse the String

About Us

Rekha SetiaRekha Setia is a passionate blogger of Extra Computer Notes. if you have any ideas or any request me @