1Z0-830 practice question 2 of 25
Which of the following statements is TRUE about modules in Java SE 21?
Full set: 116 questionsThe Java Platform Module System (JPMS), introduced in Java 9, enforces strong encapsulation and reliable configuration. A core principle is that modules must explicitly declare their dependencies. A module uses the requires directive in its module-info.java descriptor to state its dependency on another module. Without this declaration, the depending module cannot access any types from the other module at compile time or runtime, even if those types are public and exported.
A. This describes the pre-module "classpath hell" behavior. By default, modules cannot access types from other modules; packages must be explicitly exported via the exports directive.
C. Strong encapsulation in modules prevents reflective access to non-public members of a package by default. A package must be explicitly opened via the opens directive to permit this.
D. Services are a key feature of the module system, supported by the uses and provides...with directives in the module descriptor to enable a robust service-provider mechanism.
1. Oracle Corporation. (2023). The State of the Module System. JEP 454: Java Platform, Standard Edition 21. Retrieved from https://openjdk.org/jeps/261. (See section "Reliable configuration" which details the requires clause.)
2. Reinhold, M. (2017). The State of the Module System. Oracle. Retrieved from https://cr.openjdk.org/~mr/jigsaw/spec/sotms-2017-09-01.html#reliable-configuration. (The requires directive is fundamental to establishing the module graph.)
Keep practicing
Take the free 1Z0-830 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 1Z0-830 practice questions
- Question 1A consumer needs to access a service provided by another module. Which of the following s…
- Question 3What interface does a class need to implement to be eligible for serialization?
- Question 4What is the primary benefit of encapsulation in Java?
- Question 5A Path object represents which of the following?
- Question 6Which of the following statements about overloaded methods with varargs is TRUE?
- Question 7Which of the following statements is TRUE about static initializers in Java?
