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

What are the different module types in Java 9?

PHPz
Release: 2023-09-05 13:21:15
forward
1486 people have browsed it

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>
    Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template