Does anyone know...
In terms of the exam, when it states
"1.An anonymous inner class may be declared as final "
is the answer going to be false, since you cannot apply modifiers to an anonymous inner class. Or will it be true, because anonymous inner classes are implicitly final?
It seems that you could get this question wrong even if you understood anonymous classes?
If two objects are equal according to the equals(Object) method, then
calling the hashCode() method on each of the two objects must produce the
same integer result.
from :
x1.hashCode()!=x2.hashCode()
check:
(A) x2.equals(x1) == true
from:
x3.equals(x4) == false
check:
(B) x3.hashCode() != x4.hashCode()
from:
x5.equals(x6) == true
check:
(C) x5.hashCode() == x6.hashCode()
from :
x7.hashCode() == x8.hashCode()
check:
(D) x8.equals(x7) == true
It is NOT required that if two objects are unequal according to the
equals(java.lang.Object) method, then calling the hashCode() method
on each of the two objects must produce distinct integer results. However,
the programmer should be aware that producing distinct integer results for
unequal objects may improve the performance of hashtables.
1.An anonymous inner class may be declared as final
2.An anonymous inner class may be declared as private
4.An anonymous inner class can access final variables in any enclosing scope
5.Construction of an instance of a static inner class requires an instance of the enclosing outer class
This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.