import java.io.*;
public class reverse1
{
public static void main(String [] x)throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a Number");
Integer i=new Integer(br.readLine());
String ip=i.toString();
StringBuffer sf=new StringBuffer(ip);
String z=sf.reverse().toString();
System.out.println(z);
if(ip.equals(z))
System.out.println(" The Number "+ip+" is a palindrome");
else
System.out.println(" The Number "+ip+" is not a palindrome");
}
}
Thursday, March 26, 2009
java code to reverse a String
Labels:sreejithrs,nojamp,karakulam,sreejith rs
java sample code,
reverse,
String reverse
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment