module

A named set of packages with a descriptor, module-info.java, that declares what it requires, exports, opens, uses and provides.

In more detail

A module reads only the modules it requires, and other modules can use only the packages it exports. opens allows deep reflection at run time. Every module reads java.base without saying so.

Example

module com.shop.impl {
    requires transitive com.shop.api;
    provides com.shop.api.Pricing with com.shop.impl.internal.SalePricing;
}

Related terms

Taught in

References

Certification courses