Sunday 16 September 2012

Reversing a string in java

import java.util.*;
public class ReverseString{

public static void main(String args[])
{
    StringBuffer s=new StringBuffer("Java is interesting");
    System.out.println("Before reversing the string :"+s);
    s=s.reverse();
    System.out.println("After Reverse string is :"+s);

}
}

No comments:

Post a Comment