I have a simple code to test palindrome. I have the word "civic" and I got this code:
public String isPalindrome(String word) { StringBuilder builder = new StringBuilder(word); String reversed = builder.reverse().toString(); String s = new String(); if(reversed.equalsIgnoreCase(word)){ s = "Word " + parameters + " evitative is a palindrome!"; } return s; }
to my surprise, the if() condition is false even though the word is a palindrome. Any help please.
Thanks