Ask a Question
Send an email to me.
 
Java Question and Answer Forums
JavaRanch Big Moose Saloon
Marcus Green's Discussion Forum
java.sun.com Forums, Chat and User Groups
 
Other Resources
Java Language Specification
Java Virtual Machine Specification
Java 2 Platform, Standard Edition, v 1.4.0 API Specification
 
Tutorials
Learning the Java Language
Operator Precedence Chart, Expressions, Statements, Blocks
Programming with Assertions
 
Answers: Certified Java Programmer Mock Exam
No.AnswerRemark
1Compile-time error at 3.  Both class A and B are declared in the same package, so class B has access to the public, protected, and package access methods of class A.  
2c  d  e  Compile-time error at 2.  Compile-time error at 3.  Compile-time error at 4.  Classes A and D are not declared in the same package, so class D does not have access to package access method, m4. Since class D does not extend class A, class D does not have access to the protected method, m2, of class A.  
3d  e  Compile-time error at 3.  Compile-time error at 4.  Class A and C are not declared in the same package; therefore, class C does not have access to package access method, m4. Since class C extends class A, class C does have access to the protected method, m2, of class A.  

Copyright © 2002-2003, Dan Chisholm
All rights reserved.