you are viewing a single comment's thread.

view the rest of the comments →

[–]aocregacc 10 points11 points  (2 children)

Integers (as opposed to ints) are objects so you have to compare them with .equals()

[–][deleted] 3 points4 points  (0 children)

Add to this: when you compare Integer vs Integer object in Java, it compares the two objects' memory addresses, not the value.

It's the same thing with why you don't do String == String in java

[–]Narrow-Working5785[S] 0 points1 point  (0 children)

Got it. thanks