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

Do you need to strengthen the security of the mobile apps you build? Discover more than 50 secure mobile development coding practices to make your apps more secure.

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<>();


Check out tips for blazing the way from agile to DevSecOps with security built into your mobile app toolchain.

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}