Over a million developers have joined DZone.

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

Learn more about how CareerBuilder was able to resolve customer issues 5x faster by using Scalyr, the fastest log management tool on the market. 

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


try( InputStream in = new FileInputStream(new File("text.txt"))){
     // your code
  • Multi-Catch Statements - group relevant types
  } catch(InstantiationException | NoSuchMethodException | InvocationTargetException 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<>();

Find out more about how Scalyr built a proprietary database that does not use text indexing for their log management tool.


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}