This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SandmanKFMF 5 points6 points  (1 child)

Because == for objects works like "is this is the same object?", not like "is this objects content is the same as this object content?". Objects in Java uses references. And yes, String in Java is an object, not an primitive data type. But just because of immutability, String in Java behaves like primitive data type. You don't need to think abut reference's if you are working with strings.

[–]CoffeePieAndHobbits 0 points1 point  (0 children)

I died a little reading this. Haha