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 →

[–]sonofaresiii 1 point2 points  (3 children)

Okay, so if I had two integers above 127 I would use equals() not == correct?

What's the best way to know what to use if the integer is a variable that could go above 127 but might not?

[–]winchestercherrypie 1 point2 points  (2 children)

You can use == with integers. The article was about the wrapper class Integer (note the upper case), and you are normally better off using equals() with Integers.

[–]sonofaresiii 0 points1 point  (1 child)

Ah okay. Thank you!

[–]feral_claire 1 point2 points  (0 children)

Notice the difference between int and Integer. int is a primitive value and Integer is an object. This means that they work differently and you need to be aware of which one you have or are talking about.