Assume that a, b, and c refer to instances of primitive wrapper classes. Which of the following statements are correct?
Please choose 2 answers.
a.equals(a) will always return true.
b.equals(c) may return false even if c.equals(b) returns true.
a.equals(b) returns same as a == b.
a.equals(b) throws an exception if they refer to instances of different classes
a.equals(b) returns false if they refer to instances of different classes.
Stuck on this, could someone tell me the answers and explain why.
Please always tell us where such material comes from. You may find answering easier if you review the general contract for the equals() method . I presume that wrapper class means one of the following eight classes, all in the java.base/java.lang package: Boolean, Byte, Character, Double, Float, Integer, Long, Short. You may find looking at their equals() methods helpful, too.