Loading…
Loading…
Ten exam-style questions on private, package, protected and public access: same-class and same-file rules, nested classes, package access across packages, protected access through references, protected constructors and static members, and top-level class modifiers, with explanations.
Practice questions for the article Java Access Modifiers: private, Package, protected and public.
The questions follow Java 21 rules, as on the 1Z0-830 exam. For every member access, note the package of the calling class, the package of the declaring class, and the reference type. Aim for at least 8 out of 10 before moving on.
Quiz path: step 31. Take the quizzes in this order, after reading each article.
Previous quiz: Local and Instance Variables, Effectively Final and Varargs (OCP 21)
Next quiz: static Members, Static Initializers and Static Imports (OCP 21)
10 questions · pass at 68%
Check your understanding; you see the answers and explanations after submitting.
Discussion
Sign in to ask a question or share what you learned.