Can someone help me with the String comparission in Java? I mean I have two strings stored in suppose str1 and str2 and I am comparing them, it should show equal but is showing not equal. Can someone explain me what is the problem?
class Stringcmp
{6
public static void main(String args[])
{
String s1 = new String("abcd");
String s2 = new String("abcd");
if (s1 == s2)
System.out.println("Equal");
else
System.out.println("Not equal");
}
}