/*
Write a program in java to check whether an string is palindrome or not
*/
public class Palindrome
{
public static void main(String[] args)
{
String s="madam";
String s2=new StringBuffer(s).reverse().toString();
if(s.equals(s2))
System.out.println(s+" is palindrome");
else
System.out.println(s+" is not palindrome");
}
}
Write a program in java to check whether an string is palindrome or not
*/
public class Palindrome
{
public static void main(String[] args)
{
String s="madam";
String s2=new StringBuffer(s).reverse().toString();
if(s.equals(s2))
System.out.println(s+" is palindrome");
else
System.out.println(s+" is not palindrome");
}
}
Write a program in java to check whether an string is palindrome or not [All Java Interview Programs] |
0 Comment to "Write a program in java to check whether an string is palindrome or not"
Post a Comment