Question 348 of 509
Java Platform Overview and PackaginghardMultiple ChoiceObjective-mapped

Quick Answer

The answer is that the reflective call originates from a different module than the one specified in the `--add-opens` flag. This is correct because `--add-opens` requires both a source module and a target module; when you change the target from `ALL-UNNAMED` to `com.example.app`, only code within that specific module gains reflective access to `java.base/java.lang`. If the reflective access fails due to an `InaccessibleObjectException`, it means the code performing the reflection belongs to a different module—such as a third-party library or another application module—which is not listed as the target. On the Oracle Certified Professional Java SE 17 Developer 1Z0-829 exam, this tests your understanding of the module system’s strict encapsulation and the precise syntax of `--add-opens`. A common trap is assuming that changing the target to any named module automatically grants access to all application code, but the flag is module-specific, not classpath-wide. Memory tip: think of `--add-opens` as a key that only opens the door for the exact module named on the key tag.

1Z0-829 Java Platform Overview and Packaging Practice Question

This 1Z0-829 practice question tests your understanding of java platform overview and packaging. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

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?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

Question 1hardmultiple choice
Read the full NAT/PAT explanation →

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.

Option D is correct because `--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.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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.

    Clue confirmation

    The clue word "most likely" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that 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.

Detailed technical explanation

How to think about this question

Under the hood, `--add-opens` adds a qualified export to the module graph at runtime, allowing deep reflection (e.g., `setAccessible(true)`) on otherwise inaccessible members. The target module must exactly match the module name of the caller's module; if the caller is in a different named module or an unnamed module, the access is denied. In real-world scenarios, this often occurs when a library (e.g., a logging framework) runs in a separate module and tries to reflect into JDK internals, but the `--add-opens` flag only opens to the application module, not the library's module.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related 1Z0-829 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free 1Z0-829 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this 1Z0-829 question test?

Java Platform Overview and Packaging — This question tests Java Platform Overview and Packaging — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The reflective call is made from a different module than com.example.app. — Option D is correct because `--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.

What should I do if I get this 1Z0-829 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More 1Z0-829 practice questions

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.