August 2003
Intermediate to advanced
672 pages
16h 23m
English
Review Questions |
| 11.14 |
Given that the objects denoted by the parameters override the equals() and the hashCode() methods appropriately, which return values are possible from the following method?
String func(Object x, Object y) {
return (x == y) + " " + x.equals(y) + " " + (x.hashCode() == y.hashCode());
}
Select the two correct answers.
|
| 11.15 |
Insert code into the equalsImpl() method in order to provide a correct implementation of the equals() method.
public class Pair { int a, b; public Pair(int a, int b) { this.a = a; this.b = b; } public boolean equals(Object ... |
Read now
Unlock full access