O'Reilly logo
  • Jai Prakash thinks this is interesting:

We just used == to do a little exploration of wrappers. Let’s take a more thorough look at how wrappers work with ==, !=, and equals(). The API developers decided that for all the wrapper classes, two objects are equal if they are of the same type and have the same value. It shouldn’t be surprising that


Cover of OCA Java SE 8 Programmer I Exam Guide (Exams 1Z0-808)


This will not work, it's a wrong example.
Integer i =10;
Integer j = 10;

is (i==j) // TRUE
is (i!=j) // FALSE