Top Java 9 Interview Questions | JavaInUse



Java9 Interview Questions.

In this post we will look at Java 9 questions. Examples are provided with explanation.


Q: What are the main features of Java 9?
A:
  • The Java Platform module system
  • JShell: the interactive Java REPL
  • Private interface methods
  • HTTP/2
  • Improved java documentation
  • Multi-release JARs

Q: What are the advantages of Java 9 module system?
A:
  • More Consistent Performance
  • Strong Encapsulation
  • Better Flexibility in scaling
  • Enhanced Performance

Q: What is REPL in Java 9?
A:
REPL is the Read-Evaluate-Print-Loop console that comes bundled with Java 9 release. REPL allows the User to run arbitrary snippets of code and evaluate their results.

Q: What are the stream improvement of Java 9?
A:
Following are the Stream Improvements of Java 9-
  • Stream takeWhile/dropWhile
  • Stream iterate
  • Stream of Nullable

Q: Which attributes are added in @Deprecated annotation in Java 9?
A:
Following attributes are added in @Deprecated annotation in Java 9-
  • forRemoval
  • since

Q: What are the improvements done for Try With Resources in Java 9?
A:
Try Resoure block is responsible for closing resource automatically after being used.
Major drawback of this was that it required the resource to declare locally within its block.
With Java 9 the reference of the resource need not be declared locally.

Q: What is JShell in Java 9?
A:
The Java Shell tool (JShell) is an interactive tool for learning the Java programming language and prototyping Java code. JShell is a Read-Evaluate-Print Loop (REPL), which evaluates declarations, statements, and expressions as they are entered and immediately shows the results. The tool is run from the command line.

Q: What is multi-release jar format in Java 9 ?
A:
Multi-release JARs allow users create a single JAR that contains bytecode for several Java versions. JVMs will then load the code that was included for their version.


See Also

Top Java Data Structures and Algorithm Interview Questions
Spring Boot Interview Questions Apache Camel Interview Questions Drools Interview Questions Enterprise Service Bus- ESB Interview Questions. JBoss Fuse Interview Questions Top ElasticSearch frequently asked interview questions Angular 2 Interview Questions