Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Some of the JDK 1.7 Improvements in a Nutshell

DZone's Guide to

Some of the JDK 1.7 Improvements in a Nutshell

· DevOps Zone ·
Free Resource

Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

Following are the top 10 improvements impressed me over previous version of JDK. In a nutshell, I summarized below for quick look up.

  •  Underscores in Numeric Literals
   long ssn = 999_99_9999L
  • Strings in Switch Statements
String month = "Feb";
  switch(month) {
     case "January"  : <do some thing> ;break;
     case "February" : <do some thing> ;break;
     default : <do some thing> ;break;
  }
  • Automatic Resource Management

  Inout/Ouput streams need not be closed explicitly. JVM will take care of closing them when needed.

  Extended to classes which implements java.lang.AutoCloseable

  Syntax:

try( InputStream in = new FileInputStream(new File("text.txt"))){
     // your code
}
  • Multi-Catch Statements - group relevant types
try{
   ...
  } catch(InstantiationException | NoSuchMethodException | InvocationTargetException e){
     log(e);
  }     
  • New Enhanced IO package(NIO2)

Some of the new classes: java.nio.file.Paths, java.nio.file.Files, java.nio.file.FileSystem

features added to watch a directory for any changes, create a symbolic links, file copy is made easy.

  • Enhanced Concurrancy API
  • Bug Fixes on JAXP, JAX-WS, JAXB
  • JDBC 4.1

Connection, ResultSet and Statement = > now we don't need to close them manually as they implement AutoCloseable interface.

  • Fork and Join Framework
  • Diamond operator works many ways.
  Foo<Bar> bar=new Foo<>();


Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}