How to test if a String is palindrome or not in Java?

Posted on Jan 23, 2009 | Leave a Comment

Steps to check if a given string is a Palindrome or not? Step 1: Get the string instance Step 2: Reverse the string Step 3: Compare the reversed string with the original string Step 4: If it matches then it is Palindrome else not. Below code snippet does the same thing: package com.test.java;   public class PalindromeChecker {       public static void main(String[] args) {         String plCheckStr1... 
Page 1 of 11
Advertisement

Subscription

You can subscribe by e-mail to receive news updates and breaking stories.