Monday, October 30, 2017

Java 9 features

In this post we will know some of the important features of JAVA 9. There are lots of new enhancements which are going to affect your programming style. The most important improvement is modularization  of java,which should make java platform more scalable while improving its deployments on smaller devices. 


Here are list of Java 9 features:



  1.     Modularity
  2.   interface Private Methods
  3.     Strings
  4.     Diagnostics
  5.     JVM options
  6.     Logging
  7.     HTTP2 Client
  8.     JavaScript/HTTP
  9.     Native Platform
  10.     Java Docs updates
  11.     Images
  12.     Unicode
Modularity:

This is core feature of Java 9. A module is new construct like we already have packages. An application, developed using new modular programming, can be seen as collection of interacting modules with a well-defined boundaries and dependencies between those modules.

Private Methods:

 Private methods will improve code re-usability inside interfaces. For example, if two default methods needed to share code, a private interface method would allow them to do so, but without exposing that private method to it’s implementing classes.

String:

Two interesting string-related features, Compact Strings and Indify String Concatenation will be part of JDK 9. JEP 254, the compact strings optimization for OpenJDK 9 will improve the footprint of Java String and related classes while preserving full compatibility for all related Java and native interfaces. JEP 280, Indify String Concatenation will enable invokedynamic to concatenate strings, to free runtime implementors for optimizing string concatenation without pushing users to recompile their programs.

Diagnostics:

It describes in detail the diagnostic tools in JDK 9 and troubleshooting tools specific to various operating systems. 


HTTP2/Client:

HTTP/1.1 client was released on 1997. A lot has changed since. So for Java 9 a new API been introduced that is cleaner and clearer to use and which also adds support for HTTP/2. New API uses 3 major classes i.e. HttpClient, HttpRequest and HttpResponse.The beta HTTP/2 client API has come to JDK 9, implementing in Java the upgrade to the web’s core HTTP protocol. WebSocket is supported by the API as well.

The HTTP/2 API can replace the HttpURLConnection API, which has had problems, including being designed with now-defunct protocols, predating HTTP/1, being too abstract, and being hard to use.

JVM Options:

The defining feature for Java 9 is an all-new module system. When codebases grow larger, the odds of creating complicated, tangled “spaghetti code” increase exponentially. There are two fundamental problems: It is hard to truly encapsulate code, and there is no notion of explicit dependencies between different parts (JAR files) of a system. Every public class can be accessed by any other public class on the classpath, leading to inadvertent usage of classes that weren't meant to be public API. Furthermore, the classpath itself is problematic: How do you know whether all the required JARs are there, or if there are duplicate entries? The module system addresses both issues.

Modular JAR files contain an additional module descriptor. In this module descriptor, dependencies on other modules are expressed through`requires` statements. Additionally, `exports` statements control which packages are accessible to other modules. All non-exported packages are encapsulated in the module by default. Here's an example of a module descriptor, which lives in module-info.java

Logging:

Java 9 will introduce a common logging system for all JVM components. This will overhaul how the JVM reports events in its subsystems and add common logging command-line options for loggers.

Unicode:

In JDK 9, the Javadoc documentation tool is enhanced to generate HTML5 markup. The Unicode 8.0 encoding standard—which adds 8,000 characters, 10 blocks, and six scripts—is supported as well.











No comments:

Post a Comment

High Paying Jobs after Learning Python

Everyone knows Python is one of the most demand Programming Language. It is a computer programming language to build web applications and sc...