Об использовании оператора равенства Java [duplicate]
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));
}
Выход выходит:
False
true
Почему первый вывод ложен, даже если str1 и str2 кажутся равными?