Home » Java Programming » Declarations and Access Control

You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?

Correct Answer: default access

Explanation:

The only two real contenders are C and D. Protected access Option C makes a member accessible only to classes in the same package or subclass of the class. While default access Option D makes a member accessible only to classes in the same package.

← Previous Question Next Question→

More Questions from Declarations and Access Control

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion