In your case s1 is a String and s2 is StringBuffer.
The Object class’s equals method returns true if this instance is equal to the argument. That is why you got s1.equals(s2) as false.
But If you are converting the s2 to a String then that will give true value. Because string builder’s toString() method will return the String value. So please read the difference between String and StringBuffer and StringBuilder.
and toString(). equals() and hashCode() methods of Object class.
solved How Java String and StringBuffer works