this program is not working correctly

public class samp3 { public static void main(String args[]) { StringBuffer d=new StringBuffer("mom"); System.out.println(d); StringBuffer c=new StringBuffer(d); c.reverse(); System.out.println(c); if(c==d) { System.out.println("It is palindrome"); } else { System.out.println("It is not palindrome"); } } }

Your Answer

public class samp3 {
             public static void main(String args[]) {
                 StringBuffer d=new StringBuffer("mom");
                 System.out.println(d);
                 
                 StringBuffer c=d.reverse();
                
               
                 System.out.println(c);
                 if(c.equals(d)) {
                     System.out.println("It is palindrome");
                     
                 } else
                 {
                     System.out.println("It is not palindrome");
                     
                 }
                 
                 
      
     }
}

now it will be executed,try this one

Core Java

Didn't get the answer.
Contact people of Talent-Core Java directly by clicking here