posted 22 years ago
This mock question asks:
public class Parent {
final void zzz() { }
}
Which of the following methods may appear in a subclass of Parent, when the subclass is in a different package from Parent?
Choose all correct options.
A) void zzz() { }
B) void zzz(int j) { }
C) final void zzz(float f) { }
D) public final void zzz(double d) { }
The answer says:
Correct selection is: B, C, D
A final method may not be overridden; thus A is illegal. The methods in B, C, and D have different argument lists from the superclass version of the method, so B, C, and D are not examples of overriding; they are all legal.
>>> I think, though, that answer A is also valid since the question asks when you are in a different "package" from the parent. If you were in a different package wouldn't you not even be able to have access to the final void method since it isn't protected and thus you could declare your own void zzz() method since it wouldn't even see the final method in the other package?
Am I wrong in my thinking here?
thanks,
Rick