Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 127

Given the code fragment:

and

module greeting {

}

Which statement is true?

    Correct Answer: B

    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
StavokOption: B

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.

ASPushkinOption: C

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.

cathDevOption: B

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

d7bb0b2Option: B

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

d7bb0b2Option: B

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

OmnisumemOption: B

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.

dillemanOption: C

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

Ashan_OzlovOption: C

The correct answer should be C