Code: Select all
Integer i1=1;
Byte b1 = 1;
Long g1= 1L;
Code: Select all
i1.equals(g1)
Code: Select all
i1.equals(b1)
If this is the case, in this question,The equals method of all wrapper classes first checks if the two objects are of the same class or not. If not, they immediately return false.
Code: Select all
Integer i = new Integer(42);
Long ln = new Long(42);
Double d = new Double (42.0);
Code: Select all
i.equals(d);
Code: Select all
d.equals(ln)