Skip to content
Sharp

Project Structure · interview question

In JPMS, what happens if a module does not explicitly export a package?

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

Correct answer

D. The package is only accessible within the same module.

Why

In JPMS, if a package is not explicitly exported, it is only accessible within the same module, ensuring strong encapsulation by default.

Test yourself on Project Structure

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

Start free test
All Project Structure questions →