In this tutorial how to create a program to print reverse of a string with reverse() method in Core Java is shown.
Code:
Rev.java
class Rev
{
public static void main(String args[])
{
StringBuffer s1=new StringBuffer(args[0]);
s1.reverse();
String s2=args[0];
System.out.println(“The reverse of “+s2+” is “+s1);
}
}