What is the difference between String str1 = "hello";
and String str2 = new String ("hello");
in java?
I know the str2
is a object, but what about str1
?
I mean for example:
if both of them are object, but why
if(str1.toString() == str2.toString())
does not result a true boolean?
No comments:
Post a Comment