General

Palindrome Program in Java using Reverse Method1 min read

Java program to check if a string is a palindrome or not, it’s a palindrome if it remains the same on reversal.

For example, “dad” is a palindrome, as its reverse is “dad,” whereas “program” isn’t, as its reverse is “margorp” that is different from “program.”




Some palindrome strings examples are: “j”, “mom”, “madam”, “ab1ba”, “12321.”

In the program, a user inputs a string, and we create a new one by reversing it and then compares it with the input string.

Java Code: Palindrome Program in Java using Reverse Method

Output:

 

Leave a Comment