Tuesday, March 20, 2018

Write a program in java to check whether an string is palindrome or not

/*
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
Write a program in java to check whether an string is palindrome or not [All Java Interview Programs]

Share this

0 Comment to "Write a program in java to check whether an string is palindrome or not"

Post a Comment