Program-
Write a java program to read a string
and reverse it
class Reverse
{
public
static void main(String args[])
{
String
s=new String(args[0]);
String
rev=new String(""); /*
find the reverse of the string */
for(int
i=s.length()-1;i>=0;i--)
{
rev=rev+s.charAt(i);
}
System.out.println("Reverse
="+rev);
}
}
Comments
Post a Comment