1Z0-811 Java Basics and Syntax Practice Question
Which access modifier allows members to be accessed only by classes in the same package?
⚠ Common exam trap
Oracle often tests the misconception that 'default' is a keyword or that package-private access is explicitly declared with a modifier, when in fact it is the absence of any modifier, and candidates may confuse it with 'protected' which also allows package access but adds inheritance access.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
default (no modifier)
In Java, the default (package-private) access modifier, which is applied when no explicit modifier is used, restricts member access to only classes within the same package. This is the only access level that provides package-level visibility without inheritance or subclass access.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
protected
Why it's wrong here
protected allows access in subclasses and same package.
- ✓
default (no modifier)
Why this is correct
Default access is package-private.
- ✗
private
Why it's wrong here
private allows access only within the same class.
- ✗
public
Why it's wrong here
public allows access from anywhere.
Go deeper
Related to this question
About these practice questions
This 1Z0-811 question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.