A palindrome is a text phrase the reads the same backwards as fowards. So i wrote quick little app to test for a palindrome but the only ones i can think of are mom, dad, redivider, and a couple of other's. Any one know of any more?
Code:import java.io.*; class palindrome{ public static void main(String[] args){ BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); for(int i = 0; i <= 4; i++){ try{ System.out.println("Enter a word to see if it is a plaindrome:"); StringBuffer sb1 = new StringBuffer(buff.readLine()); String s1 = new String(sb1); sb1.reverse(); if(s1.equalsIgnoreCase(sb1.toString())){ System.out.println(s1 + " is a plaindrome "); }else{ System.out.println(s1 + " is not a plain drome "); } System.out.println(); }catch(Exception e ){System.err.println(e);} } } }


Reply With Quote
oh my....... thanks
