Java MCQ: What is a key advantage of using Java modules introduced in Java 9?
Answer:
Explanation:
Java modules, introduced in Java 9, provide a key advantage by enabling better encapsulation and modularization of code. The module system allows developers to group related packages into a module, which can define what is exposed to other modules and what remains internal. This enhances code organization and security, as it prevents unintended access to internal classes and methods.
Modules help reduce complexity in large applications by clearly defining the dependencies between different parts of the application, making it easier to manage and maintain the codebase. The module system also supports the creation of custom runtime images that include only the necessary modules, optimizing application performance and size.
The introduction of modules in Java 9 represents a significant step forward in building more maintainable, scalable, and secure applications.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html