palindrome in java
public class PlaindromeTest1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter your words"); // Whats up body? // ?ydob pu stahW
String word = input.nextLine();
String reversedWord = "";
// start from last index number.
for(int i = word.length()-1; i>=0; i-- ){
reversedWord += word.charAt(i);
}
System.out.println(reversedWord);
//Level ==> leveL //ey edip adanada pide ye :)
boolean palindrome = word.equalsIgnoreCase(reversedWord);
System.out.println(palindrome);
String str = "Anna";
String result = "";
for(int i = str.length()-1; i>=0; i-- ){
result += str.substring(i, i+1);
// result += str.charAt(i); // char at de olur
}
boolean result1 = str.equalsIgnoreCase(result);
System.out.println(result1);
}