I have only seen questions where Integer
objects were involved in the discussion:
How do I compare two Integers?
and was wondering what the procedure should be for the primitive int
.
int a = 250;
int b = 250;
System.out.println(a == b); // doesn't work for larger ints 127<
System.out.println(a.equals(b)); // doesn't work for primitive ints
What should one do in this case? Should one instead use the Object wrapper for int
?