File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes RHE mock question bonus1 q49 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "RHE mock question bonus1 q49" Watch "RHE mock question bonus1 q49" New topic

RHE mock question bonus1 q49

Rick Reumann
Ranch Hand

Joined: Apr 03, 2001
Posts: 281
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?
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

You are right A is correct, it's mentioned in the RHE errata. Have a look at this.
- Manish

[This message has been edited by Manish Hatwalne (edited October 24, 2001).]
I agree. Here's the link:
subject: RHE mock question bonus1 q49
It's not a secret anymore!