View Single Post
Old 03-18-07, 01:14 PM   #2
Cinema4DXL
Registered User
 
Join Date: Sep 2004
Posts: 97
Default Re: Java Help: Palindrome program

have you tested this, because

if (strInputReverse.compareTo(strInputTrimmed) < 0)
{
System.out.println("\nYou didn't type a Palindrome.");
}
else
{
System.out.println("\nYou typed a Palindrome!");
}


The compareTo method only does string comparsions lexicographically. This does not ensure that you have a correct palindrome.

I suggest your program for test cases, also your program ignores a string has that spaces, does it handle other characters like ? . , (not sure what the scope of your project is) if it is to handle any kind of string input.
__________________
Athlon XP-M 2600+@(200x11.5) | Abit AN7 | 2x512 Corsair XMS PC-3200 | BFG 6800 GT OC (400/1100) w/ NV Silencer 5 | Promise Ultra133TX2 | WD Caviar SE 80GB 8 MB | Seagate Barracuda 7200.7 160GB | Maxtor DiamondMax 10 300GB | Sony 16x DVD-ROM | NEC 3520A | Antec SmartPower 2.0 500w | Koolance PC-601 | Samsung SyncMaster 997DF
Cinema4DXL is offline   Reply With Quote