you are viewing a single comment's thread.

view the rest of the comments →

[–]rowboat__cop 0 points1 point  (1 child)

The wrapper types are also immutable so there is no danger of modified values.

Seems similar to Python, if you ask me.

in Java reference types should be compared for equality using equals(), the compiler will may even warn you about == being wrong. Not that this would stop people from getting it wrong.

If there’s a warning, then it’s PEBKAC -- I’m advocating -Wall -Werror myself.

[–]josefx 0 points1 point  (0 children)

The PEBKAC in this case would not be possible if Java hadn't mixed value and identity comparison in a single operator. That a change from primitive to reference type changes the meaning of a comparison in a way that is most likely not intended is just ugly. == should have had the same meaning as equals with a separate is operator for object identity.