Home  >  Article  >  Java  >  What are the different module types in Java 9?

What are the different module types in Java 9?

PHPz
PHPzforward
2023-09-05 13:21:151414browse

Java 9中有哪些不同的模块类型?

Module system is a new feature introduced in Java 9. A module is a set of packages , divided into two types: exported packages and hidden packages . Export packages can be used outside this module. Hidden packages cannot be used outside this module; only the code of this module can use these packages.

There are four types of modules in Java 9, as follows:

  • Application module: This module is used to implement Function. All Third Party dependencies fall into this category.
  • Auto modules: Jars without module descriptors can be placed in modules in the module path. The main benefit of this module is the use of pre-Java 9 build jars.
  • Unnamed module:
  • Any jar or class on the classpath belongs to an unnamed module. Since it doesn't have any name, it can read and export all modules.
  • Platform Modules:
  • The JDK has been converted into a modular structure and these are called platform modules.
    <strong>module <Module-Name> {
       requires moduleName;
       exports packageName;
    }</strong>

The above is the detailed content of What are the different module types in Java 9?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete