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
What is the correct directory layout expected when placing a module named `com.example` on the module path?
Answer: A subdirectory named `com.example/` containing `module-info.class` at its root
When using an exploded module directory, the module path entry should be the parent directory, and the module root must be a directory named after the module (e.g., `com.example/`) containing `module-info.class`.
Which option to `jlink` sets the name and location of the output runtime image?
Answer: --output
`jlink --output ` specifies the directory where the generated runtime image will be written.
A `ServiceLoader` call returns no providers even though a provider JAR is on the module path. What is the most likely cause?
Answer: The provider module does not declare `provides with ` in its module-info.java
A provider module must declare `provides with ` in its `module-info.java` to be discovered by `ServiceLoader`.
What does the `--patch-module` JVM flag do?
Answer: Adds classes or resources into an existing named module at runtime
`--patch-module =` merges additional classes or resources from the given path into the named module, commonly used for testing.
Which statement about `module-info.java` and multi-release JARs is correct?
Answer: A single module-info.java at the root applies to all Java versions in the JAR
A multi-release JAR has one `module-info.java` at the root (or in the base entry) that defines the module for all versions contained in the JAR.
What is the effect of compiling a module with `javac --release 11 --module-source-path src -m com.example`?
Answer: Compiles the com.example module and its sources from the directory matching its name under src/
`-m com.example` with `--module-source-path` tells `javac` to compile the named module, looking for its sources in the `src/com.example/` subtree.
What is the role of `module-info.java`'s `provides` directive in conjunction with `ServiceLoader`?
Answer: It registers a concrete implementation class as a provider for a given service interface
`provides with ` registers the implementation as a service provider discoverable via `ServiceLoader` without needing META-INF/services files.