1Z0-829 Java Platform Overview and Packaging Practice Question
Network Topology
Given the module descriptor for com.example.payment:
module com.example.payment { exports com.example.payment; // does not require com.example.store
}
And the Main class is in the unnamed module (on the classpath). The invocation is:
java --add-modules com.example.store --module-path mods -cp classes com.example.Main
What will happen?
⚠ Common exam trap
Test-takers frequently assume that simply placing a module on the module path makes it automatically accessible to the unnamed module, but the module system requires explicit opt-in via `--add-modules` for modules not required by a named module.
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
✓
The application runs successfully because com.example.store is added with --add-modules, and its exported packages are available.
The `--add-modules com.example.store` directive explicitly adds the module `com.example.store` to the set of root modules at startup, making its exported packages available to the unnamed module (or to modules that do not otherwise require it). Since the `Main` class is in the unnamed module (not in a named module), it can access the exported packages of `com.example.store` without a `requires` clause. This is the intended behavior of `--add-modules` for resolving modules that are not automatically resolved.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The application runs successfully because com.example.store is added with --add-modules, and its exported packages are available.
Why this is correct
--add-modules makes com.example.store available to other modules, including the main module.
- ✗
The application throws NoClassDefFoundError because the Main class is in a different module.
Why it's wrong here
The main class is specified correctly as com.example.payment/com.example.payment.Main.
- ✗
The application runs successfully because com.example.store is on the module path.
Why it's wrong here
It runs, but not because of that reason; the main module is payment.
- ✗
The application throws ModuleNotFoundException because com.example.store is not required by com.example.payment.
Why it's wrong here
Although not required, --add-modules adds it anyway; it's optional.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-829 question from scratch — 513 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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-829 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-829 exam.