Your method getPhrase returns a boolean. At the line
getPhrase( s );
You're calling that method to determine if the
String sent in is a palindrome, but you're throwing away the result of the method call by not doing anything with that result. Plus
if ( true )
is always going to be true because "true" is a boolean literal.
There a two ways to fix this. You can assign the result of the method call to a some variable and then
test the value of that variable in your if condition:
boolean isPalindrome = getPhrase( s ) ;
if ( isPalindrome ) ...
But since you're not using that value anywhere else you can just do the method call directly in the condition:
if ( getPhrase( s ) ) ...
Also, "getPhrase" doesn't say a lot about what the method does. You might consider renaming to something like
if ( isPalindrome( s ) ) ...
***
You mentioned testing a "word," so I'm guessing it's okay for your purposes things like
A man, a plan, a canal -- Panama!
don't count as palindromes? (Things that contain characters other than letters or digits.)
At any rate, you might want to consider elimnating case considerations. In your version "Mom" isn't a palindrome. String has a handy method that tests for equality, ignoring the case of letters.