Java Reference
In-Depth Information
LISTING 5.9
continued
if (left < right)
System.out.println ("That string is NOT a palindrome.");
else
System.out.println ("That string IS a palindrome.");
System.out.println();
System.out.print ("Test another palindrome (y/n)? ");
another = scan.nextLine();
}
}
}
OUTPUT
Enter a potential palindrome:
radar
That string IS a palindrome.
Test another palindrome (y/n)? y
Enter a potential palindrome:
able was I ere I saw elba
That string IS a palindrome.
Test another palindrome (y/n)? y
Enter a potential palindrome:
abcddcba
That string IS a palindrome.
Test another palindrome (y/n)? y
Enter a potential palindrome:
abracadabra
That string is NOT a palindrome.
Test another palindrome (y/n)? n
Search WWH ::




Custom Search