Development process, Expertise, Java Development,

5 main features of Java 9 to create top-class projects

4 m read
QArea Team
QArea Team Marketing Manager
November 23, 2017
Share on
Reading Time: 4 minutes

 

Java 9 release date has rocked the tech world in late September. Now, when the flutter of the novelty quietly subsides, it’s time to talk about Java 9 features and the practical value they actually present. Read now – what’s new in Java and how to benefit from writing code with this brand new update.

NEW Java 9

With the new update, Java once again proves its relevance and superiority over trendy technologies. Now it is fair to expect the new wave of the boom for Java application development.

Among the main features of Java 9 (Java Development Kit 9), most often mentioned are the following:

  • Modularity
  • JShell
  • Reactive programming support
  • TTP/2 client API
  • Improved HTML5 and Unicode support

Let us consider these in details to understand what useful options they add to software development and how to apply them in the most efficient way.

Modularity

One of the most significant innovations is the emergence of a modular system. Prior to Java 9, JAR files were used to develop Java-based applications. However, this architecture has several limitations and disadvantages. To eliminate them, modular system has been implemented. This innovation is part of the Jigsaw project, which is designed to allow developers to separate programs into independent and inter-program modules.

Here are some functions of this system:

  • Modular JDK;
  • Modular Java source code;
  • Modular run-time images;
  • Encapsulation of internal APIs;
  • Modular platform system.

JDK 9 comes with 92 modules. It is possible to use all the existing, or create our own, like:

module com.foo.bar { }

This allows customizing tasks and functions to go beyond programming borders and extend the range of possibilities.

JShell

Oracle has recently introduced a new tool called JShell. It is used to test and apply various constructs in the console, for example, classes, interfaces, enumerations, objects, operators, etc. It presents a very handy tool for the developer and enables writing test cases without creating a project, just like , just like Java developers at QArea do. For example:

1. Importing packages

Example of connecting packages:

jshell> /imports

| import java.util.*

| import java.io.*

| import java.math.*

| import java.net.*

| import java.util.concurrent.*

| import java.util.prefs.*

| import java.util.regex.*

2. Expressions

Example of entering an expression and printing the result:

jshell> 3+3

$1 ==> 6

| created scratch variable $9 : int

jshell> $1

$1 ==> 6

| value of $1 : int

Variables

Example of variable declaration:

jshell> int x=5

x ==> 5

| created variable x : int

jshell> x

x ==> 5

| value of x : int

3. Declaring methods

Example of declaring a new method or updating an existing one:

jshell> void helloJShell() { System.out.println("hello JShell"); }

| created method helloJShell()

jshell> helloJShell();

hello JShell

jshell> void helloJShell() { System.out.println("wow, I replaced a method"); }

| modified method helloJShell()

| update overwrote method helloJShell()

jshell> helloJShell()

Commands

listing variables:

jshell> /vars

| int x = 0

| double j = 0.5

listing methods:

jshell> /methods

| printf (String,Object...)void

| helloJShell ()void

The printf method is defined by default.

listing sources

jshell> /list

14 : helloJShell();

15 : void helloJShell() { System.out.println("wow, I replaced a method"); }

16 : helloJShell()

editing sources in the external editor

jshell> /edit helloJShell

/help returns a full list of supported commands

Reactive programming support

The main distinctive feature of reactive programming is that it enables asynchronous data streams. In Scala, Play, Akka, reactive streams have already been integrated. Oracle decided to add the Reactive Streams API in JDK 9.

Java SE 9 Reactive Streams API is a framework for implementing asynchronous, scalable and parallel applications using Java.

In Java 9, there are the following APIs:

  • java.util.concurrent.Flow;
  • java.util.concurrent.Flow.Publisher;
  • java.util.concurrent.Flow.Subscriber;
  • java.util.concurrent.Flow.Processor.

TTP/2 client API

Significant changes occurred in the HTTP client to support the HTTP / 2 and WebSocket protocols.They replace the Http URLConnection API with a new, more productive one. The new API is presented in the “java.net.http” package. It supports both synchronous and asynchronous modes.

Improved HTML5 and Unicode support

New Java now has an option of generating doclet for the code using HTML5. Outwardly, there are no directly visible differences, but now thanks to HTML5 tags we get:

  • Simplified, understandable syntax;
  • Continuous error handling;
  • Best mobile support;
  • Support for the WAR-ARIA standard.

What’s more in Java 9?

In addition to the features above, it is also necessary to highlight the changes and updates in syntax, which include:

  • Try-with-resources;
  • Diamond operator for anonymous classes;
  • Private methods in interfaces.

The full list of the new features and updates is available here.

Java 9 benefits and application

JDK 9 provides a convenient platform for writing any type of application. With 17 years experience in custom software development on Java, QArea engineers unanimously approve the 9th version is primarily necessary for the web projects and enterprise level projects.

Any new technology is based on previous experience, which allows solving new issues and relieves previous problems and difficulties. Those who succeed to master it have a significant advantage of performing tasks faster and better. But there is also a downside to the coin – many projects running on older platforms cannot be simply ported to a new technology. That is why, for the new projects, we certainly recommend choosing the development with Java 9.

How to add value with Java 9

The 9th version of Java allows to significantly fasten the development time of the project thanks to new APIs, classes, and new syntax. If you feel like developing a new project on Java with the best-in-class Dedicated Team or have any questions – contact us. We will be glad to explain the process in more detail!

You may also like:

10 Java Experts And Developers To Follow On Social Media

The Leading Java Programming Tools

How To Make Java Wait

 

Categories

Recent Posts

  • Refactor or not refactor? Everything there is to know about refactoring

    Read more
  • What is Ambient Proximity? Definetely More Than A Buzzword

    Read more
  • GDPR: why so serious?

    Read more
Yes
Share on
Privacy Preference Center
Your Privacy

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.

Strictly Necessary Cookies Always Active

These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.

You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.

Performance Cookies

These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site.

All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.

Cookies used

Google Analytics
Functional Cookies

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.

Cookies used

Test Second Test
Targeting Cookies

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.

More Information

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.