Question 1
A colleague hands you a compiled modular JAR for module com.store in the mods directory, but no source. Before you write any code against it, you want to see which packages it exports and which services it provides — without launching the application. Which command prints that module descriptor?
A. java --module-path mods --list-modules com.store
--list-modules enumerates the observable modules and their versions but prints no directives, so it cannot reveal which packages a module exports or which services it provides.
B. java --module-path mods --describe-module com.storeCorrect answer
java --describe-module resolves the named module on the module path and prints its full descriptor — requires, exports, opens, uses and provides — then exits without launching the application.
C. jdeps --module-path mods --list-deps com.store
jdeps --list-deps reports what the module depends ON, the opposite direction, so it does not print the module's own exports and provides.
D. jlink --module-path mods --describe com.store
jlink assembles custom runtime images and has no --describe option, so this command cannot print a module descriptor.
Explanation
java --describe-module <module> (short form -d) resolves the named module on the module path and prints its descriptor: requires, exports, opens, uses and provides. --list-modules is the near miss: it enumerates the observable modules and their versions, but prints no directives, so it cannot tell you what com.store exports. jdeps --list-deps reports what a module depends ON (the other direction), and jlink has no --describe option at all — it assembles runtime images.