Declarations and Access Control

Q1: 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?

A default access

B protected

C public

D private

ANS:D - default access

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.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.