
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
What are the characteristics of a module in Java 9?
The module is a collection of code, data, and resources. It is a set of related packages and types like classes, abstract classes, and interfaces with code, data files, and some static resources.
Below are some of the characteristics of a module.
Characteristics of a module:
- A module must define an interface for communication with other modules.
- A module defines the separation between a module interface and module implementation.
- A module presents a set of properties that contains information.
- Two or more modules have nested together.
- A module has a clear, defined responsibility. Each function implemented by only one module.
- A module must able to tested independently from other modules.
- An error in a module can't propagate to other modules.
If we have two modules: M1 and M2 and one package in a module. M2 called Pkg2 that we want to be accessible in module M1, then the following conditions have to meet:
- Module M1 depends on module M2, then module M1 can specify in its declaration that "requires” module M2.
- Module M2 export the package Pkg2 in order to make it available to modules that depend on it. In the declaration of the module M2, we can specify that it “exports” package Pkg2.
- Related Articles
- What are the benefits of a module in Java 9?
- What are the different compilation modes of a module in Java 9?
- What are the different module types in Java 9?
- What are the components in a module-info file in Java 9?
- What are the advantages and disadvantages of the Module System in Java 9?
- Importance of Module Descriptor in a Module in Java 9?
- What is Module System in Java 9?
- What is an unnamed module in Java 9?
- What is the use of the "requires" clause in a module-info file in Java 9?
- What is the use of the "export" clause in a module-info file in Java 9?
- How to create a module in Java 9?
- What are the characteristics of lambda expressions in Java?
- When to use the ServiceLoader class in a module in Java 9?
- What are the characteristics of a compound?
- What are the advantages of Modules in Java 9?

Advertisements