How to Create a Program to Print Reverse of a String With reverse() method in Core Java

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);
}
}

https://youtu.be/Ch8hqIkfpf4

Add a Comment

Your email address will not be published. Required fields are marked *