aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "RHE mock question bonus1 q49" Watch "RHE mock question bonus1 q49" New topic
Author

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?
thanks,
Rick
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

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

[This message has been edited by Manish Hatwalne (edited October 24, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RHE mock question bonus1 q49
 
Similar Threads
from RHE Bonus Questions
Package and Overriding
RHE Bonus1 Q49
R&H bouns1-49
R&H bonus1 q49