Skip to content
Sharp

Project Structure · interview question

Why does the module-info.java file in a Java project matter in practice?

Multiple choiceEasychapter-10-curatedpremiumproject-structurejava-modules-jpms
Choose one answer
Answer and explanation

Correct answer

B. To define module dependencies and specify exports

Why

The module-info.java file is used to declare the dependencies a module has, which packages it exports, and which services it provides or consumes, enforcing strong encapsulation.

Test yourself on Project Structure

A free test with instant, explained results. No account needed.

Start free test
All Project Structure questions →