Results 1 to 6 of 6

Thread: palindrome's?

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    palindrome's?

    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);} 
       }      
      }
     }

  2. #2
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    pop
    tot
    hannah
    deed
    toot
    Alcohol & calculus don't mix.
    Never drink & derive.

  3. #3

  4. #4

  5. #5

  6. #6
    VirtuallyVB
    Guest

    Red face radar

    radar...doh (Homer style)
    I see you've got some links.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width