Modules System 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 Modules System flashcards as text
Which JDK tool creates a custom runtime image from a set of modules?
Answer: jlink
'jlink' assembles and optimizes a custom runtime image containing only the specified modules and their transitive dependencies.
What does the 'jdeps' tool primarily do in the context of the module system?
Answer: Analyzes class files to determine module and package dependencies
'jdeps' analyzes class-file bytecode and reports module-level and package-level dependencies.
What is the unnamed module in Java's module system?
Answer: A special module that contains all classes loaded from the classpath
The unnamed module is a catch-all module that contains all types loaded from the classpath, enabling backward compatibility.
Which JVM option allows deep reflection from one named module into a package of another module at runtime without modifying source?
Answer: --add-opens
'--add-opens module/package=targetModule' grants reflective access similar to an 'opens' directive without modifying module-info.
A module-info.java contains 'exports com.example.util to com.app.core;'. This means:
Answer: Only com.app.core can access the public types in com.example.util
A qualified export restricts access to the exported package's public types to only the specified module(s).
What is the primary purpose of JMOD files created by the 'jmod' tool?
Answer: To package modules including native code for use with jlink
JMOD is a packaging format used mainly for JDK modules; it supports native libraries and config files that regular JARs can't include, used by jlink.
What happens if two named modules on the module path export the same package?
Answer: A split package error occurs at startup or compile time
Split packages (the same package in more than one named module) are forbidden and result in an error.