Reverse string using StringBuffer class
class InvertString
{
public static void main(String args[])
{
StringBuffer a = new StringBuffer("Java programming is fun");
System.out.println(a.reverse());
}
}
StringBuffer class contains a method reverse which can be used to reverse or invert an object of this class.
No comments:
Post a Comment