It may seem a little premature to be talking about Java 9 interview questions. However, good interviewers look for candidates that keep up-to-date with the news on Java world. Java 9 (particularly Project Jigsaw) is arguably one of the most promising improvement to Java and therefore you should watch out for questions about it. The following questions should cover the basics.
What do you know about project Jigsaw?
Project Jigsaw is intended to modularize Java. Each module can explicitly declare its public API with everything else being internal details that Java developers can change without impacting existing clients. These will lead to more maintainable and strong encapsulated Java libraries.
One of the interesting consequences is that the Java Runtime Environment (JRE) itself will be modularised. Unlike now, where you are forced to install the full JRE, it will be possible to install parts of it. This will significantly reduce the installation size greatly benefiting the adoption of Java in small devices such as phones, TVs, etc.
Project Jigsaw is also intended to resolve the JAR hell, even though not everyone is convinced that it will do so.
Describe a situation where having the Java Module System (project Jigsaw) would be beneficial ?
If you go to the main website of RxJava (popular Java library for asynchronous and event-based programming), you will find this comment: “rx.internal.* - All code inside the rx.internal.* packages are considered a private API and should not be relied upon at all. It can change at any time.” here
This is a (not so great) way overcoming a serious Java flaw: it’s currently impossible to build a library with an internal API that is not exposed to the library clients. Java 9 modularisation is intended to overcome this flaw by letting the library designers export an API, with the rest of the public methods for internal consumption only.
Other than the project Jigsaw, what other Java 9 features have you heard about ?
jshell - Java 9 will ship with a full-fledged REPL (Read-Eval-Print-Loop) shell. This is great if you just want to try out a few lines of code. It is already available here.
Full support for HTTP 2.0 - HttpURLConnection API is a super-generic API that is supposed to work with every single protocol you can imagine (ftp, http/1.1, gopher, …). Unsurprisingly, it is not very popular among Java developers. The new HTTP client API will implement HTTP/2 and WebSocket protocols. It is much easier to use and it will work for the blocking one thread per request/response model, but also for asynchronous non-blocking use cases here.