Java SE 11 Developer (1Z0-819) — Question 50

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?

Answer options

Correct answer: C

Explanation

The correct answer is C because it exports a specific class from the clients package, allowing it to be accessible to other modules that require it. Option A is incorrect as it tries to require itself, which is not valid. Option B is also wrong because 'uses' is meant for service provision, not for exporting packages. Option D is incorrect since it exports the entire package, which may not be necessary if only specific classes need to be accessed.