DEV Community

Rajesh Mishra
Rajesh Mishra

Posted on • Originally published at on


Palindrome Program in Java for Reversing String

Palindrome is nothing but any number or a string which remains unchanged when it is reversed. For example: 121 or RAR. It is observable that letters form reflect images on turn around.

class PalindromeProgramInJavaForReversingString{
      public static void checkPalindrome(String s){
      // Reversing given string using StringBuffer class
      String reverse = new StringBuffer(s).reverse().toString();

      // checks whether the string is palindrome or not
      if (s.equals(reverse)){
          System.out.println("Yes, it is a palindrome");
          System.out.println("No, it is not a palindrome");
     public static void main (String[] args)throws java.lang.Exception{

Learn More about Palindrome:

Latest comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git