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.

You May Also Like:

Reverse a string in Java (6 Different Ways)
Splitting a String in Java using a delimiter
Count number of words in a string java
Count total number of times each character appears in the string in java
Check if two strings are anagrams or not in java
How to convert string to int without using library functions in java
How to find first non-repeated character in a given String in Java
How to find first non-repeatable character from a String using Java 8
Java Program to find the frequency of each character in String ?

If you have any feedback or suggestion please feel free to drop in below comment box.

Leave a Reply

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