Skip to content
Sharp

Project Structure · interview question

How would you explain a key advantage of using Java modules in a project in an interview?

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

Correct answer

D. Improved encapsulation and package access control

Why

Java modules allow you to explicitly control which packages are accessible outside of a module, enforcing strong encapsulation. This helps maintain architectural boundaries and prevents unwanted access.

Test yourself on Project Structure

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

Start free test
All Project Structure questions →