Possible Duplicate:
How do I compare strings in Java?
class StringTest {
public static void main(String[] args) {
String str1 = "Hi there";
String str2 = new String("Hi there");
System.out.println(str1 == str2);
System.out.println(str1.equals(str2));
}
The output is coming out:
False
true
Why the first output is false even when the str1 and str2 appear to be equal?