Java 9 version has introduced new enhancements and added new features. It includes JShell, Http2Client, Java Platform Module System (JPMS), Multi-release jar files, Stack Walking API, Private methods in an interface, Process API updates, Collection API updates, Stream API improvements, and etc.
Below are the few differences between Java 8 and Java 9
- In Java 8 and earlier versions, the top-level component is the package. It places a set of related types (classes, interfaces, enums, and etc) into a group, and also contains a set of resources whereas Java 9 introduces a new component: module, which can be used to place a set of related packages into a group, and also another new component: the module descriptor, module-info.java file.
- Java 8 applications use packages as a top-level component whereas Java 9 applications use modules as a top-level component.
- Each Java 9 module has only one module with one module descriptor whereas Java 8 package doesn't build multiple modules into a single module.
Java 8:
Packages - Types (classes, enums, interfaces, etc) - Code - Data - Resources - xml - images - properties
Java 9:
Modules (Resources, Module Descriptor) - Packages - Types (classes, enums, interfaces, etc) - Code - Data - Resources - xml - images - properties