Share on Google+Share on Google+

Java Program to check Palindrome

In this section, you will learn about the palindrome number and how to determine any number is palindrome or not.

Java Program to check Palindrome

In this section, you will learn about palindrome in java and how to check any number that is palindrome or not. First of all what is palindrome number?, this is the number that the original number is same after reversing this. For example let us suppose that, the original number is 121 and by reversing this number we get the same number, then it is called palindrome number otherwise it is not.

Description of program : With the help of this program, we are going to check whether the number is palindrome or not. At first you have to defined a class name "palindrome". After that will ask the user to enter any number of type integer and then reverse that number. After reversing that number check whether that number is palindrome or not. We will check it in the if condition that the reverse number is equal to the original number otherwise else part get executed and prints "This is not palindrome".

import java.util.Scanner;
public class Palimdrome 
   public static void main(String args[])
	    System.out.println("Enter the number you want to check ");
		int  number= new Scanner(;
	    int palimdrm=number;// sin copied to palimdrome
	    int reverse=0;
	    	int rem=palimdrm%10;
	    	reverse=reverse *10 + rem;
	    	 System.out.println("This is palindrome number");
	    	 System.out.println("This is not palindrome number");

Output from the program :

Download Source Code


Posted on: June 25, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Java Program to check Palindrome  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image