public class palindrome {
public static void main(String[] args) {
String original, reverse="";
original = "jaj";
int length = original.length();
for ( int i = length - 1 ; i >= 0 ; i-- )
reverse = reverse + original.charAt(i);
if (original.equals(reverse))
System.out.println("Palindrome, Original - "+ original+ " Reversed - " + reverse);
else
System.out.println("Not a Palindrome, Original - "+ original+ " Reversed - " + reverse);
}
}
public static void main(String[] args) {
String original, reverse="";
original = "jaj";
int length = original.length();
for ( int i = length - 1 ; i >= 0 ; i-- )
reverse = reverse + original.charAt(i);
if (original.equals(reverse))
System.out.println("Palindrome, Original - "+ original+ " Reversed - " + reverse);
else
System.out.println("Not a Palindrome, Original - "+ original+ " Reversed - " + reverse);
}
}