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
What keyword is used in a module-info.java to grant reflective access to all packages in a module to another module?
Answer: opens
The 'opens' directive grants deep reflective access (including private members) to another module at runtime.
Which command-line option adds a module to the set of root modules resolved by the module system?
Answer: --add-modules
'--add-modules' explicitly adds one or more modules to the root module set during resolution.
In module-info.java, 'requires transitive com.example.api;' means that:
Answer: Any module requiring the current module implicitly also requires com.example.api
'requires transitive' creates an implied readability dependency so consumers of your module also read com.example.api without declaring it themselves.
Which command inspects the module descriptor of a modular JAR file?
Answer: jar --describe-module
'jar --describe-module' (or '-d') prints the module descriptor of a modular JAR file.
What happens when you place a non-modular JAR on the module path?
Answer: It becomes an automatic module with a name derived from the JAR filename
Non-modular JARs on the module path become automatic modules, with a name derived from the JAR filename or Automatic-Module-Name manifest entry.
Which directive declares that a module provides an implementation of a service interface?
Answer: provides com.example.Service with com.example.impl.ServiceImpl
The 'provides ... with ...' directive registers a service provider implementation with the module system.
What is the purpose of the 'uses' directive in a module-info.java?
Answer: It declares that the module may discover service providers via ServiceLoader
The 'uses' directive declares a service dependency, enabling ServiceLoader to find implementations at runtime.