Skip to content
Sharp

Project Structure · interview question

Given the following module-info.java, which statement is true regarding package visibility?

Multiple choiceHardchapter-10-curatedpremiumproject-structurejava-modules-jpms
java
module com.store {
  exports com.store.product;
}
Choose one answer
Answer and explanation

Correct answer

A. Only 'com.store.product' is accessible to other modules

Why

In the given module-info.java, only 'com.store.product' is explicitly exported, meaning it's the only package accessible to other modules. Without an 'exports' declaration, packages remain inaccessible from outside the module.

Test yourself on Project Structure

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

Start free test
All Project Structure questions →