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

A company has an existing Java app that includes two Java 8 jar files, sales-8.10.jar and clients-10.2.jar.

The jar file, sales-8.10.jar, references packages in clients-10.2.jar, but clients-10.2.jar does not reference packages in sales-8.10.jar.

They have decided to modularize clients-10.2. jar.

Which module-info.java file would work for the new library version clients-10.3.jar?

    Correct Answer: D

    The module-info.java file needs to specify which packages it exports so that other modules can access them. The correct syntax for this is 'exports com.company.clients;'. This ensures that the necessary packages from clients-10.3.jar are accessible to the sales-8.10.jar module. Therefore, option D, which uses the correct 'exports' directive, is the right choice.

Discussion
ASPushkinOption: D

answer : D client-10.2.jar becomes as a named module after modulizing sales-8.10.jar migrates as unnamed module The unnamed module reads every other module. But it still does not have access to non-exported packages in named module So we need to provide export directive in it module descriptor in the format of requires modulename;

d7bb0b2Option: D

D is correct: exports only can export packages not clasess

StavokOption: D

The correct answer is D.

StavokOption: D

The correct answer is D. module com.company.clients { exports com.company.clients; }. The module-info.java file defines the module and its dependencies. Since the sales-8.10.jar file references packages in clients-10.2.jar, the new clients-10.3.jar module should export the necessary packages so that they can be accessed by other modules. In this case, the com.company.clients package should be exported using the exports directive.

tmuralimanoharOption: D

Answer: D

ObaltOption: D

Correct answer is D