boolean palindrom = (revNum == number);
System.out.println(number + " is " +
(palindrom ? "a palindrom" : "not a Palindrome")); return palindrom;
}
}
It gives the following output,
234 is not a Palindrome
232 is a Palindrome
2332 is a Palindrome
23232 is a Palindrome
12345 is not a Palindrome
234 is not a Palindrome
232 is a palindrom
2332 is a palindrom
23232 is a palindrom
12345 is not a Palindrome