Skip to content
Sharp

Project Structure · interview question

What does the 'exports' directive do in a module-info.java file?

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

Correct answer

B. It makes a package accessible to other modules.

Why

The 'exports' directive is used to make a package accessible to other modules, thereby allowing other modules to use the public types within the exported package.

Test yourself on Project Structure

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

Start free test
All Project Structure questions →