What is a module?

When we discuss modular systems, immediately you might ask what is a module? A module is a collection of code, data, and resources with self-descriptive properties. It contains a set of packages and types such as classes, abstract classes, interfaces, and so on, and also, most importantly, every module contains a module-info.java file.

A module can explicitly declare which package needs to export for other modules and what is required from other modules in order to compile and run. This will also help us to identify which module is missing when we get an error.

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.