So i'm trying to have the user input a string, print it backwards and then compare the new strings to see if it is a palindrome or not... It doesn't seem to be working and i'm not sure why...
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.print("Enter a word: ");
String word = input.next();
StringBuilder drow = new StringBuilder(word);
drow.reverse();
System.out.println(drow);
System.out.print(" ");
String X = drow.toString();
if (word == X) {
System.out.println("That word is a palindrome");
} else {
System.out.println("That word is not a palindrome");
}
Thanks for any help to why this isn't working...