To Find the Palandrum String

To Find the Palandrum String Program in Java

public class PalandrumString

 {

public static void main(String args[])

{

   StringBuffer s1=new StringBuffer(“SrS”);

   StringBuffer s2=new StringBuffer(s1);

    s1.reverse();

     System.out.println(“given:”+s2.toString());

      System.out.println(“reverse:”+s1.toString());

   if(String.valueOf(s1).contentEquals(String.valueOf(s2)))

        System.out.println(“equal”);

    else

        System.out.println(” not equal”);
 
}

}

Leave a Reply