Check Whether a Given String/Number is a Palindrome in java

By | August 7, 2018

In this post we will learn how to check  whether a given String/Number is a Palindrome or not in java.
Before start writing a java program let’s try to understand.

What is Palindrome?

If a String or a Number is a palindrome if it remains unchanged when reversed, for example “mom” is a palindrome as reverse of the mom is again mom. Another example is “malayalam” or 12344321.

You may refer  Reverse a string in Java program with 5 Different Ways   that may be helpful to you to understand the logic used behind the Palindrome check program

Approach 1:

Approach 2:

Approach 3:

Approach 4:

Approach 5:

I have checked all the above programs for few inputs as below. You may check for other input as well

You would love to watch me on YouTube:

That’s all about  this topic How to check Whether a Given String/Number is a Palindrome in java
If you have any feedback or suggestion please feel free to drop in blow comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *