1z0-819 Exam QuestionsBrowse all questions from this exam

1z0-819 Exam - Question 111


Given:

Given the directory structure:

Given the commands to execute at the Test directory prompt:

Which statement is true?

Show Answer
Correct Answer: D

The provided code snippet utilizes the `Module` class in Java to obtain and print information about the module in which the class `Hello` resides. When executed with the provided commands (`javac -d pac Hello.java` and `java -cp pac pac.Hello`), the program operates in an unnamed module since it is run from the classpath and not the module-path. As a result, the program prints 'Module: unnamed module', 'Name: null', and 'Descriptor: null' because unnamed modules do not have a name or descriptor.

Discussion

3 comments
Sign in to comment
[Removed]Option: D
Aug 30, 2023

D is indeed Correct. Tested

ASPushkinOption: D
Jun 4, 2024

D. correct this class loadedd using classpath so this is unnamed moduler A. Failed unnamed moduler doesn't have moduler-info

ASPushkinOption: D
Jun 6, 2024

Of course, syntax error has to be corrected javac -d pac Hello.java -> javac -d Test Hello.java java -cp pac pac.Hello -> java -cp Test Test.Hello