Thursday, June 6, 2019

What is the difference between String str1 = "hello"; and String str2 = new String ("hello"); in java?

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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...