class Test{
public static void main(String args[])
{
String s1="hello";
String s2=new String("hello");
if(s1 == s2)
System.out.println("both are same");
else
System.out.println("not same");
}
}
1) equals() method compare the content of the string
2) == operator compares the reference of the string objects