Project Structure · interview question
Why is it important to have strong encapsulation in a module system like JPMS?
Multiple choiceMediumchapter-10-curatedpremiumproject-structurejava-modules-jpms
Answer and explanation
Correct answer
A. To prevent unauthorized access to internal APIs.
Why
Strong encapsulation prevents unauthorized access to internal APIs, reducing the risk of misuse and improving maintainability by clearly defining the module's public interface.
Test yourself on Project Structure
A free test with instant, explained results. No account needed.
More Project Structure questions
- Why might you choose to use integration tests despite their higher resource cost compared to unit tests?
- Why do teams use Continuous Integration in software development in production code?
- Which JUnit assertion would you use to verify that a method returns a null value?
- Which of the following strategies can prevent a bad merge into the main branch in a CI/CD workflow?
- In a JPMS setup, what happens if a module exports a package but does not specify which other modules can access it?
- How would you explain a key advantage of using Gradle over Maven in Java projects in an interview?