Courseiva
Java Platform Overview and PackaginghardMultiple ChoiceObjective-mapped

1Z0-829 Java Platform Overview and Packaging Practice Question

An application uses `--add-opens java.base/java.lang=ALL-UNNAMED` to allow reflective access to `java.lang` internals from the classpath. After migrating to a module, the flag is changed to `--add-opens java.base/java.lang=com.example.app`. Yet reflective access still fails with `InaccessibleObjectException`. What is the most likely reason?

⚠ Common exam trap

Many candidates assume `--add-opens` with a specific module name opens the package to all modules, when in fact it only opens to the named module, and the reflective caller must belong to that exact 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 reflective call is made from a different module than com.example.app.

`--add-opens` specifies which module's package is opened to which target module. When the flag is changed from `ALL-UNNAMED` to `com.example.app`, only code in the `com.example.app` module is granted reflective access. If the reflective call originates from a different module (e.g., a third-party library or another application module), the `InaccessibleObjectException` will still be thrown because that module is not listed as the target.

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 class performing reflection is in an unnamed module.

    Why it's wrong here

    If it were unnamed, ALL-UNNAMED should work.

  • The module does not read the module java.base.

    Why it's wrong here

    All modules read java.base by default.

  • The module name in --add-opens is misspelled.

    Why it's wrong here

    If misspelled, it would have no effect, but the error mentions InaccessibleObjectException.

  • The reflective call is made from a different module than com.example.app.

    Why this is correct

    --add-opens opens only for the specified target module(s); if the code is in another module, it fails.

About these practice questions

This 1Z0-829 question is part of Courseiva's 513-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 →

How Courseiva writes practice questions · Editorial policy

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.