Java implementation of the contentEquals method
Codeaft.java
class Codeaft
{
    public static void main(String args[])
    {
        String s1="HELLO";
        String s2="WORLD";
        String s3="HELLO";
        String s4="Hello";

        boolean b=s1.contentEquals(s2);
        System.out.println(b);
        b=s1.contentEquals(s3);
        System.out.println(b);
        b=s1.contentEquals(s4);
        System.out.println(b);
    }
}
Output
codeaft@codeaft:~$ javac Codeaft.java
codeaft@codeaft:~$ java Codeaft false true false codeaft@codeaft:~$
Comments and Reactions