Java 7 and 8 feature of new java

The feature of java 7 and 8 :

  • Strings in switch statements

java7_loiane_01

  • Improved Exception handling with multi-catch
} catch (FirstException | SecondException ex) {
     logger.error(ex);
    throw ex;
}
  • Try-with resources
	try (BufferedReader br = new BufferedReader(new FileReader("C:\\testing.txt")))
		{

			String line;

			while ((line = br.readLine()) != null) {
				System.out.println(line);
			}

		} catch (IOException e) {
			e.printStackTrace();
		}
  • Diamond Syntax
public void testDinamond(){
    List<String> list = new ArrayList<>();
    Map<String, List<String>> map = new HashMap<>();
}
  • NIO 2 : Path , File and Asynchronous I/O
<pre>ThreadFactory myThreadFactory = Executors.defaultThreadFactory();

AsynchronousChannelGroup channelGroup = AsynchronousChannelGroup.withFixedThreadPool(25, myThreadFactory);</pre>
  • Functional Interface
  • Lambda Expressions
  • JSR 310
  • Parallel Collection
  • Nashorn Javascript Engine

One thought on “Java 7 and 8 feature of new java

  1. Pingback: Internet Marketing Programs That Work

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s