nerdexam
Oracle

1Z0-829 · Question #40

Which statement is true about modules?

The correct answer is C. Automatic and named modules are on the module path. C is correct because both named modules (JARs/code with an explicit module-info.java) and automatic modules (JARs placed on the module path without a module-info.java) reside on the module path - Java auto-generates a module descriptor for automatic modules based on the JAR…

Packaging and Deploying Java code

Question

Which statement is true about modules?

Options

  • AAutomatic and unnamed modules are on the module path.
  • BOnly unnamed modules are on the module path.
  • CAutomatic and named modules are on the module path.
  • DOnly named modules are on the module path.
  • EOnly automatic modules are on the module path.

How the community answered

(40 responses)
  • B
    3% (1)
  • C
    93% (37)
  • D
    5% (2)

Explanation

C is correct because both named modules (JARs/code with an explicit module-info.java) and automatic modules (JARs placed on the module path without a module-info.java) reside on the module path - Java auto-generates a module descriptor for automatic modules based on the JAR filename.

Why the distractors fail:

  • A & B are wrong because the unnamed module lives on the classpath, not the module path - it's the catch-all bucket for legacy code that hasn't been modularized.
  • D is wrong because it excludes automatic modules, which are very much on the module path.
  • E is wrong because it excludes named modules, which are the primary residents of the module path.

Memory tip: Think of it as two worlds - the old world (classpath → unnamed module) and the new world (module path → named + automatic modules). Automatic modules are the bridge: they're legacy JARs promoted into the new world by dropping them on the module path.

Topics

#Java modules#module path#JPMS#module types

Community Discussion

No community discussion yet for this question.

Full 1Z0-829 Practice