Java 11 Interview Questions and Answers
Experienced / Expert level questions & answers
Ques 1. What is Java Mission Control in Java 11?
Java Mission Control is an application that can analyze the dumps that come from Java Flight Recorder, and give you a graphical overview of what's happening inside of a JVM.
Ques 2. What is Epsilon: A No-Op Garbage Collector in Java 11?
Epsilon is the "No Op" garbage collector. It allocates new memory but never recycles it. Once the application exhausts the available Java heap, the JVM shuts down. It means, Epsilon will allow your application to run out of memory and crash. Elipson is good only for test environments and no-op garbage collector is useful for measuring and managing application performance.
Java 11 also added Z Garbage Collector(ZGC), which promises to manage large heaps with high throughput and short pause times. You need to specify below two runtime switches on the command line, to tell the JVM to use the Epsilon GC
XX:+UnlockExperimentalVMOptions
-XX:+UseEpsilonGC
Below command generate heap dump if JVM runs out of memory.
-XX:HeapDumpOnOutOfMemoryError
Run specified command when an out-of-memory error occurs.
-XX:OnOutOfMemoryError=
Ques 3. What is Remove the Java EE and CORBA Modules in Java 11?
Java 11 removed the Java EE and CORBA modules from the Java SE Platform and the JDK, these modules were already deprecated in Java 9 with the declared intent to remove them in a future release.
- java.xml.ws (JAX-WS, plus the related technologies SAAJ and Web Services Metadata)
- java.xml.bind (JAXB)
- java.activation (JAF)
- java.xml.ws.annotation (Common Annotations)
- java.corba (CORBA)
- java.transaction (JTA)
- java.se.ee
- jdk.xml.ws (Tools for JAX-WS)
- jdk.xml.bind (Tools for JAXB)
Ques 4. What is HTTP Client (Standard) in Java 11?
It standardizes Http Client API, in the java.net.http package, based upon the incubated API, and removed the incubated API. The new API supports both HTTP/1.1 and HTTP/2. It is designed to enhance the overall performance of sending requests by a client and receiving responses from the server. It also natively supports WebSockets.
Ques 5. What is Key Agreement with Curve25519 and Curve448 in Java 11?
Java makes further improvements in cryptography which provides security and performance. This feature implements a key agreement using Curve25519 and Curve448. Other cryptography libraries, such as OpenSSL and BoringSSL, already support key exchanges using Curve25519 and Curve448.
Ques 6. What is Flight Recorder in Java 11?
Java Flight Recorder (JFR) is a profiling tool that collects data about events during the execution of a Java application in Java Virtual Machine (JVM). JFR is integrated into the JVM and part of the JDK distribution.
- Using Command Line: Compile FlightRecTest Java program by executing the below command, which will generate FlightRecTest.class file at src/com/withoutbook/flightrecorder location.
Once compilation is successful, the following options can be taken to start the program:javac -d out -sourcepath src/com/withoutbook/flightrecorder/FlightRecTest.java
java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=200s,filename=recording.jfr -cp ./out/ com.withoutbook.flightrecorder.FlightRecTest
- Using Diagnostic Command: The jcmd tool also allows registration of events to start. To start a 70-second recording on the running Java process with the identifier 4532 and save it to recording.jfr in the current directory, use the following:
Below commands relevant to Java Flight Recorder are:jcmd 4532 JFR.start duration=70s filename=recording.jfr
//Start a recording.JFR.start//It check the status of all recordings running for the specified process, including the recording file name, identification number, duration.JFR.check//It stop recording with a specific identification number, by default, recording 1 is stopped.JFR.stop//It dump the data collected by the recording with a specific identification number, by default, data from recording 1 is dumped.JFR.dump
Ques 7. What are ChaCha20 and Poly1305 Cryptographic Algorithms in Java 11?
Java 11 has Implement the ChaCha20 and ChaCha20-Poly1305 ciphers.
ChaCha20 is a new stream cipher which replaces the older, insecure RC4 stream cipher.
Poly1305 is a cryptographic Message Authentication Code (MAC), used on both Encrypted and Decrypted messages, it creates the authentication token and guarantees the integrity of the message.
In ChaCha20-Poly1305 algorithm, ChaCha20 Stream cipher performs the Encryption and Poly1305 performs the Authentication. The ChaCha20 and ChaCha20-Poly1305 algorithms will implement the javax.crypto.CipherSpi API within the SunJCE provider.
Ques 8. What is Low-Overhead Heap Profiling in Java 11?
It provides a way to get information from the JVM about Java object heap allocations that:
- Is low-overhead enough to be enabled by default continuously
- Is accessible via a well-defined, programmatic interface
- Sample all allocations (which is not limited to allocations that are in one particular heap region or that were allocated in one particular way)
- It can be defined in an implementation-independent way (i.e., without relying on any particular GC algorithm or VM implementation)
- It provide information about both live and dead Java objects.
Ques 9. What is Transport Layer Security (TLS) 1.3 in Java 11?
Transport Layer Security, or TLS, is a cryptographic protocol that protects data exchanged over a computer network. TLS (Transport Layer Security) and is the successor to SSL (Secure Sockets Layer). TLS provides secure communication between web browsers and servers.
TLS 1.3 is a major revision of the TLS protocol and provides significant security and performance improvements over previous versions.
Ques 10. Write about Deprecate the Nashorn JavaScript Engine in Java 11?
Below two JDK modules will be terminally deprecated, by using annotation @Deprecated(forRemoval=true):
- jdk.scripting.nashorn -- contains the jdk.nashorn.api.scripting and jdk.nashorn.api.tree packages.
- jdk.scripting.nashorn.shell -- contains the jjs tool. Running jjs will display a warning:
Most helpful rated by users: