Sunday , December 11 2016
Home / Blue J / Java program to check for palindrome

Java program to check for palindrome

Java program to check for Palindrome.

What is a palindrome number or palindrome string? There are following definitions:

  1. A palindrome number or a palindrome string is one whose mirror image is same as itself.
  2. A Palindrome is exactly same as seen from beginning or ending.

Concept used here:

if(s.charAt(i) == s.charAt(l-i-1);

MADAM :

s.charAt(0) =M    (first character)
s.charAt(l-1-0) =M (last character)

Now check for ‘A’ –
A is the second character in the string – Check if it is also the second last character.
D is the third character in the string – Check if it is also the third last character in the string.

OUTPUT:

Java program for palindrome
Java program to check for palindrome

Incoming terms: check whether a number is a palindrome number or not.

Also See:   Program for string in cross x format on given position

Check Also

Program for Matrix Multiplication in JAVA

Matrix Multiplication:– Here is given a Java Program for Matrix Multiplication also call matrix product. In ...

Leave a Reply

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

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.