Posts

Showing posts from November 9, 2014

write a java program to find whether a given string is palindrome or not

import java.io.*; public class a { public static void main(String args[])throws Exception { String s,s2=""; int i;
DataInputStream dd=new DataInputStream(System.in); System.out.println("Enter a string"); s=dd.readLine(); s=s.trim();
for(i=0;i<s.length();i++) s2=s.charAt(i)+s2;
if(s.equals(s2)) System.out.println("It is  a palindrome"); elseaba System.out.println("Not a palindrome"); }
}