Java 11 Interview Questions and Answers
Intermediate / 1 to 5 years experienced level questions & answers
Ques 1. What is Flight Recorder in Java 11?
Java Flight Recorder is an always-on, low-overhead, data collection framework that you can use to get metrics on your JVMs. It's implemented as a bounded circular buffer, which buffers internal JVM metrics for a configurable amount of minutes. The great thing about this feature is that you can leave it enabled on your prediction systems because it's so low overhead.
Ques 2. What is Dynamic Class-File Constants in Java 11?
The Java class-file format is now expanding support for a new kind of constant pool, called CONSTANT_Dynamic. The loading of CONSTANT_Dynamic delegates the creation of a bootstrap method. Same as linking an invokedynamic call site delegates linkage to a bootstrap method. Same as, Java 7 which introduces MethodHandle and MethodType entry in constant pool.
Ques 3. What is Improve Aarch64 Intrinsics in Java 11?
Improve the current string and array intrinsic, and added new intrinsics on AArch64 processors for the java.lang.Math sin, cos and log functions. Intrinsics are used to optimize CPU architecture-specific assembly code that is executed for a given method to boost performance, instead of generic Java code. Although most of the intrinsics are already implemented in port AArch64, optimized intrinsics are still lacking for the following java.lang.Math methods:
- sin (sine trigonometric function)
- cos (cosine trigonometric function)
- log (logarithm of a number) This JEP is intended to cover this gap by implementing optimized intrinsics for these methods.
Ques 4. What is Local-Variable Syntax for Lambda Parameters in Java 11?
It allows var to be used when declaring the formal parameters of implicitly typed lambda expressions.
In Java 10, Local Variable Type Inference was introduced.
var str = "Java 10"; // infers Stringvar list = new ArrayList<String>(); // infers ArrayList<String>var stream = list.stream(); // infers Stream<String>svar bos = new ByteArrayOutputStream();
Java 11, allows var to be used to declare the formal parameters of an implicitly typed lambda expression.
(var a, var b) -> a + b
The examples below are illegal:
// Not allowed to mix 'var' and 'no var' in implicitly typed lambda expression(var a, b) -> a+b// Not allowed to mix 'var' and manifest types in explicitly typed lambda expression(var a, int b) -> a+b
Ques 5. What is Unicode 10 in Java 11?
It supports the latest Unicode version, particularly in the classes below:
- Character and String in the java.lang package
- NumericShaper in the java.awt.font package
- Bidi, BreakIterator, and Normalizer in the java.text package
Ques 6. What is Launch Single-File Source-Code Programs in Java 11?
It enhances the Java launcher to run the program provided as a single Java source code file, including the use of "shebang" files and related techniques from within the script.
Ques 7. What is ZGC: A Scalable Low-Latency Garbage Collector(Experimental) in Java 11?
The Z Garbage Collector, also known as ZGC, is a low latency scalable garbage collector designed to meet the following objectives.
- Pause times shall not exceed 10 ms
- Handle heaps ranging from a few hundred megabytes to multi terabytes in size
- Pause times do not increase with the size of the heap or live-set.
Ques 8. Tell me about Deprecate the Pack200 Tools and API in Java 11.
Below three types will be deprecated from java.base module, i.e. with annotation @Deprecated(forRemoval = true):
- java.util.jar.Pack200
- java.util.jar.Pack200.Packer
- java.util.jar.Pack200.Unpacker
Most helpful rated by users:
- What is Java 11?
- What is Local-Variable Syntax for Lambda Parameters in Java 11?
- What is the difference between Oracle JDK and OpenJDK?
- What is Java Mission Control in Java 11?
- Which commercial features are available as open source in Java 11?