Java SE 11 Developer (1Z0-819) — Question 102
Which two statements are correct about modules in Java? (Choose two.)
Answer options
- A. module-info.java cannot be empty.
- B. module-info.java can be placed in any folder inside module-path.
- C. By default, modules can access each other as long as they run in the same folder.
- D. A module must be declared in module-info.java file,
- E. java.base exports all of the Java platforms core packages.
Correct answer: D, E
Explanation
The correct answers are D and E because a module must indeed be declared in the module-info.java file to be recognized, and java.base does export all of the core packages of the Java platform. Options A and B are incorrect as module-info.java can be empty and must be placed in a specific location, while C is wrong since modules cannot access each other just by being in the same folder unless explicitly declared.