Modular Development & Deployment Practices Flashcards
7 cards from real 1Z0-819 practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Modular Development & Deployment Practices flashcards as text
Which `module-info.java` directive allows a module to read another module's types without the consuming module explicitly requiring it?
Answer: requires transitive
`requires transitive` causes any module that requires the current module to also implicitly read the specified dependency.
A developer runs `java --list-modules`. What does this command display?
Answer: All observable system modules bundled with the JDK
`--list-modules` without additional arguments lists all observable system (platform) modules available in the running JDK.
Which tool is used to link a set of modules into a custom runtime image in Java 11?
Answer: jlink
`jlink` assembles and optimizes a set of modules and their transitive dependencies into a custom, self-contained runtime image.
What happens when you place a modular JAR on the class path instead of the module path?
Answer: The module-info.class is ignored and the JAR is treated as unnamed module content
When a modular JAR is placed on the class path, `module-info.class` is ignored and its classes become part of the unnamed module.
Which command-line option allows code in an unnamed module to access a specific package in a named module at runtime?
Answer: --add-exports
`--add-exports` makes a package in a named module accessible to another module (or unnamed module) without modifying `module-info.java`.
In a `module-info.java`, what is the purpose of the `uses` directive?
Answer: It declares that the module consumes a service via ServiceLoader
The `uses` directive specifies a service interface that this module may look up at runtime using `ServiceLoader`.
Which `jdeps` flag generates a `module-info.java` template for a non-modular JAR?
Answer: --generate-module-info
`jdeps --generate-module-info ` analyzes dependencies and writes a draft `module-info.java` to the specified directory.