I couldn't figure out the following behaviour,
String str1= "abc";
String str2 = "abc";
System.out.println("str1==str2 "+ str1==str2);
System.out.println("str1==str2 " + (str1==str2))
Output for the above statement is as follows:
false
str1==str2 true
Why is this happening? Why the output is not like follows:
str1==str2 true
str1==str2 true
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…