1z0-819 Exam QuestionsBrowse all questions from this exam

1z0-819 Exam - Question 127


Given the code fragment:

and

module greeting {

}

Which statement is true?

Show Answer
Correct Answer: BC

The correct statement is that public members in the com.name package are accessible only to the greeting module. This is because the export directive in the citizen module explicitly states that the com.name package is exported to the greeting module, meaning that only the greeting module can access the public members of com.name. Therefore, the correct option is B.

Discussion

8 comments
Sign in to comment
StavokOption: B
Jul 20, 2023

The correct answer is B. An exports module directive specifies one of the module’s packages whose public types (and their nested public and protected types) should be accessible to code in all other modules1. In this case, the citizen module exports the com.name package to the greeting module, making its public members accessible only to the greeting module.

Ashan_OzlovOption: C
Oct 2, 2023

The correct answer should be C

dillemanOption: C
Oct 4, 2023

C does sound correct. B is probably not correct since the public members in com.name is also available to the citizen-module.

OmnisumemOption: B
Oct 4, 2023

Agree with Stavok. An exports…to directive enables you to specify in a comma-separated list precisely which module’s or modules’ code can access the exported package—this is known as a qualified export.

d7bb0b2Option: B
Dec 11, 2023

B is correct, to use exports to permit to access to public members from com.name wihtouht explicit requires in module-info .

d7bb0b2Option: B
Jan 8, 2024

A is bad : citizen has only access to public members of pacakge

cathDevOption: B
Apr 10, 2024

The correct statement is B. public members in the com.name package are accessible only to the greeting module

ASPushkinOption: C
May 6, 2024

The exports to directive in the citizen module doesn't exempt the target module from explicitly requiring the dependency module. Just specifying export package in the required module is not enough.