Java 9¶
Java 9 (2017):
- Module System (Project Jigsaw): Introduced modular programming to Java.
// module-info.java
module com.example.myapp {
requires java.logging;
exports com.example.myapp.api;
}
-
JShell (REPL): Interactive Java shell for quick testing and prototyping.
-
Improved Javadoc: Added search functionality and HTML5 support.
-
Collection Factory Methods: Convenient ways to create immutable collections.
List<String> list = List.of("a", "b", "c");
Set<String> set = Set.of("x", "y", "z");
Map<String, Integer> map = Map.of("key1", 1, "key2", 2);
Source¶
- [Java 9 Features | Java Point]