import java.util.Scanner;
public class JavaApplication52 {
public static String reverse(String word){
String newWord = "";
for (int i = (word.length()-1); i >= 0; i--){
newWord += word.charAt(i);
}
return newWord;
}
public static boolean isPalindrome(String word){
if (word.equals(reverse(word))){
return true;
}
else{
return false;
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Type in your text:");
String text = scan.nextLine();
if (isPalindrome(text) == true){
System.out.println("Your word is a palindrome!");
}
else{
System.out.println("Not a palindrome :(");
}
}
}
I hope this works!