Search Tutorials

Top Java 11 (2023) Interview Questions | JavaInUse

Top Java 11 frequently asked interview questions.

In this post we will look at Java 11 Interview questions. Examples are provided with explanations.

Q: What are the methods added in String API in Java 11?

A :
  • isBlank - Returns true if the String is empty or contains only spaces
  • lines - Returns a stream of lines extracted from the string, separated by line terminators such as \n, \r
  • strip(), stripLeading(), stripTrailing() - strip whitespaces from the string
  • repeat(int n) - Returns a new string which is the concatenation of this string repeated 'n' times

Q: What is the Z Garbage Collector introduced in Java 11?

A : The Z Garbage Collector, also known as ZGC, is a scalable low latency garbage collector designed to meet the following goals:
  • Pause times do not exceed 10ms
  • Pause times do not increase with the heap or live-set size
  • Handle heaps ranging from a few hundred megabytes to multiterabytes in size

Q: What is the Java Flight Recorder introduced in Java 11?

A : Java Flight Recorder (JFR) is a Java profiling tool that monitors and diagnoses a running Java application. It is responsible for collecting data about the running environment, JVM and Java application and dumps the recorded data into a .jfr file, and we can use Java Mission Control (JMC) to analyze and visualize the .jfr file.

How to launch Single-File Source-Code Programs in JDK 11?

A : Before Java 11 -
java HelloWorld
Java 11 -

How to get Java 11 run-time environment working since there is no more JRE 11 for download?

A :
  • Download and use an OpenJDK Java 11 JDK from the OpenJDK site.
  • Download and use an Oracle Java 11 JDK from the Oracle site and be sure that you fully understand the restrictions on "commercial use" that now apply to the Oracle Java 11+ releases.
  • Roll own Windows JRE for Windows from the OpenJDK sources; see Create jre from OpenJDK Windows.
  • Look into using the new jlink tool to create a custom image (basically a cut-down JRE) for your application. This seems to be the option that Oracle want 3rd-party application developers to use.
  • Talk to Oracle sales about a Java support contract, and specifically ask about how to get a JRE build.
  • Use a 3rd-party Java JRE distribution such as AdoptOpenJDK.

How to install OpenJDK 11 on Windows?

A : Set a PATH: Go to Advanced and then Environment Variables - Give path of your JDK bin
Set JAVA_HOME: Create a variable named JAVA_HOME and give JDK path till JDK folder(above bin)

See Also

Spring Boot Interview Questions Apache Camel Interview Questions Drools Interview Questions Java 8 Interview Questions Enterprise Service Bus- ESB Interview Questions. JBoss Fuse Interview Questions Angular 2 Interview Questions