- Generics
- Metadata
- Autoboxing and unboxing
- Enumerations
- The swing of JDK1.5 has an all-new look
- Varags
- Enhanced for each loop
- Concurrency utilities
JDK 1.6
- Improved performance(JDK 1.6 is faster )
- JavaScript that is integrated and included in the entire platform
- JDBC4 implementation
- Enhanced web services support(Client and Core Java Architecture for XML-Web Services (JAX-WS) 2.0 APIs)
- API for XML digital signature services for secure web services
- Support for Java Architecture for XML Binding (JAXB) 2.0
- improved security enhancements (Native platform security, Java Authentication and Authorization Service (JAAS), the New Smart Card I/OAPI, native security services)
JDK 7
(July 2011)
- String in switch
- Improved Type Inference for generics instance creation
From: Map<String, List<String>> map = new HashMap<String, List<String>>();To:
Map<String, List<String>> map = new HashMap<>();- Better Exception Handling (Multiple exceptions handling to eliminate duplication of codes)
Before:
try {
// execute code that may throw 1 of the 3 exceptions below.
} catch(SQLException e) {
logger.log(e);
} catch(IOException e) {
logger.log(e);
} catch(Exception e) {
logger.severe(e);
}
After:try {
// execute code that may throw 1 of the 3 exceptions below.
} catch(SQLException | IOException e) {
logger.log(e);
} catch(Exception e) {
logger.severe(e);
}
- Automatic resource management in try-statementTry with resources:
Before:
BufferedReader br = new BufferedReader(new FileReader(path));
try {
return br.readLine();
} finally {
if (br != null) br.close();
}
After:
try (BufferedReader br =
new BufferedReader(new FileReader(path))) {
return br.readLine();
}
- JDBC enhancement
JDK8
(March 2014)
- Language-level support for Lambda Expressions
- PermGen completely removed and replaced with a new space called Metaspace
- New Date and Time API
- Small VM
JDK 9
September 22, 2016
- Jshell = Java + REPL
- G1 will be the new default garbage collector
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.
No comments:
Post a Comment