J.VIII · Java 25 practice question

Which two responsibilities does a named module's declaration fulfill for controlling the universe of available types?

Choose one answer
Check answer and explanation

Correct answer: It specifies dependences on other modules and specifies which of its own packages are exported or opened

Explanation

A module declaration defines a named module by declaring dependences on other modules for its own code and specifying which of its packages are exported or opened for other modules that depend on it.

Common trap

Module declarations operate at the package and module level, not by enumerating individual class files or per-class versions. JVM memory settings and ahead-of-time compilation are runtime or build concerns, not part of a JLS module declaration.

Source: JLS SE 25 §7.7. Module Declarations
Checked against the cited text on 2026-11-25.

Report an error in this question