← All 1Z0-819 Flashcard Decks

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
  1. What is the correct location for module-info.java in a standard Maven project layout?

    Answer: src/main/java/module-info.java at the root of the source tree

    module-info.java lives at the root of the module's source tree, directly in src/main/java for Maven projects.

  2. Which statement correctly describes an automatic module's readability?

    Answer: An automatic module reads all other named modules and the unnamed module

    Automatic modules have unrestricted readability — they read every module on the module path plus the unnamed module, enabling legacy code to work.

  3. What is the effect of passing '--module-source-path' to javac?

    Answer: It enables multi-module compilation by specifying the root of multiple module source trees

    '--module-source-path' enables javac to compile multiple modules simultaneously by specifying the directory that contains each module's source folder.

  4. Which 'opens' syntax in module-info.java opens a package to ALL other modules for deep reflection?

    Answer: opens com.example.internal;

    An 'opens' directive without a 'to' clause makes the package open for deep reflection to all modules.

  5. What does 'requires static com.example.annotation;' mean in module-info.java?

    Answer: The dependency is required at compile time but optional at runtime

    'requires static' declares a compile-time-only dependency; the module is not required to be present at runtime.

  6. When using ServiceLoader.load(MyService.class), which module system requirements must be satisfied?

    Answer: The consuming module needs 'uses MyService' and provider modules need 'provides MyService with ...'

    ServiceLoader requires the consumer to declare 'uses' and each provider to declare 'provides ... with ...' in their respective module descriptors.

  7. Which java command-line option grants a named module access to unexported public types of another named module?

    Answer: --add-exports

    '--add-exports sourceModule/package=targetModule' allows the target module to access public types in the package as if it were exported.