 <p>The equality operator(==) checks the refernce of string first then checks value of string. While equals method checks the value first. So,in this case equals method should be used instead of equality operator.<code> String s="hello"; String s1="hello"; String s3=new String("hello")</code> In the above code snippet if you use <code>If(s==s1){System.out.print("Equal");}</code>it would print equal.But if you check <code>If(s==s3){System.out.print("unqual");}</code>it wouldn't print unequal. so,you can see that even strings s and s3 are equal,output is wrong.Therefore,in this scenario like program in question </p> <blockquote> <p>Equals method must be used.</p> </blockquote>