JavaJava 11 Featuresintermediate
Updated:

Java 11 Features Interview Questions and Answers

5 min read

The Java 11 features interviewers ask about — the standard HttpClient, new String and Files methods, var in lambdas and why Java 11 is a key LTS release.

TL;DR – Quick Answer

Java 11 interviews focus on the practical additions that changed everyday code: the standardized HttpClient, convenient new String methods (isBlank, strip, lines, repeat), local-variable syntax for lambda parameters, single-file source execution, and the significance of Java 11 as a Long-Term-Support release. Interviewers want to know you have used these, not just read the release notes.

On This Page

Why Java 11 features come up

Java 11 is a Long-Term-Support release, which means a huge amount of production code still runs on it and many teams treat it as their baseline. Interviewers ask about it to check two things: that you keep up with the language, and that you have actually used the additions rather than just recognizing their names. Because the changes are small and practical, they are easy to demonstrate with a line of real code — which is exactly what a good answer does.

This page covers the Java 11 additions that come up most, and where they matter in day-to-day work. To see how the language continued to evolve, pair it with the Java 17 features questions.

Q1. Why is Java 11 significant as a release?

Java 11 is an LTS (Long-Term-Support) release, so it received extended updates and became the standard target for many enterprises for years. It standardized the new HttpClient, added everyday String and file conveniences, allowed running a single source file directly, and removed modules that had been bundled with the JDK, such as Java EE and CORBA.

The removal of bundled Java EE and CORBA modules is a favorite follow-up because it broke some applications on upgrade — those APIs had to move to external dependencies. Framing Java 11 as "the LTS most teams jumped to after Java 8" gives the interviewer the context they are looking for.

Q2. What is the new HttpClient, and why did it matter?

Java 11 promoted a modern HttpClient in the java.net.http package to a standard feature. It supports HTTP/2, WebSocket, a clean builder API, and both synchronous and asynchronous (CompletableFuture-based) requests — replacing the clunky HttpURLConnection and removing the need for a third-party library for basic HTTP.

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://example.com/data"))
        .GET()
        .build();
HttpResponse<String> response =
        client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());

The asynchronous variant, sendAsync, returns a CompletableFuture so you can compose non-blocking pipelines. Being able to contrast synchronous send with asynchronous sendAsync shows you understand why the API was designed the way it was.

Q3. What new String methods did Java 11 add?

isBlank() reports whether a string is empty or whitespace-only; strip(), stripLeading() and stripTrailing() remove whitespace in a Unicode-aware way; lines() returns a stream of the lines in a multi-line string; and repeat(int) repeats a string efficiently.

"  hi  ".strip();          // "hi" — Unicode-aware, unlike trim()
"   ".isBlank();           // true
"ab".repeat(3);            // "ababab"
"a\nb\nc".lines().count(); // 3

The interview point on strip() versus trim(): trim() only removes characters up to U+0020 and misses many Unicode whitespace characters, while strip() uses Character.isWhitespace. Naming that distinction is exactly the kind of detail that signals hands-on use.

Q4. What is local-variable syntax for lambda parameters?

Java 11 allows var for lambda parameters, so you can write (var x, var y) -> .... On its own that is cosmetic, but it exists so you can apply annotations to a lambda parameter whose type is inferred — which was previously impossible without writing the explicit type.

// var in a lambda enables annotations on an inferred-type parameter
BiFunction<Integer, Integer, Integer> add =
        (@NonNull var a, @NonNull var b) -> a + b;

The rule to remember: it is all-or-nothing — you cannot mix var and explicit types in the same lambda's parameter list. This is a small feature, and saying "its real purpose is enabling annotations, not saving keystrokes" is the answer that lands.

Q5. How does single-file source-code execution work?

Java 11 lets you run a .java file directly with java Hello.java, without a separate javac step. The launcher compiles the source in memory and runs its main method. It is designed for scripts, quick experiments and teaching — not for multi-file production applications.

The limitation to mention: it works for a single source file only; anything with multiple classes across files still needs normal compilation and packaging. It lowered the barrier for beginners and made Java usable for small scripting tasks, which is the intent behind the feature.

Q6. What is the difference between trim() and strip(), practically?

trim() predates Unicode awareness and only strips characters with a code point at or below U+0020 (space), so it silently leaves many Unicode whitespace characters in place. strip() uses Character.isWhitespace, correctly removing Unicode whitespace. For any modern, internationalized input, prefer strip().

This question is really testing whether you know that trim() is legacy. A clean answer states the code-point rule for trim() and the Unicode-aware rule for strip(), and concludes with "so I default to strip()."

Q7. What was removed or deprecated around Java 11 that you should know?

Java 11 removed the bundled Java EE and CORBA modules (JAXB, JAX-WS and related), which had been deprecated earlier. Applications relying on them must add explicit dependencies after upgrading. The Nashorn JavaScript engine was also deprecated for later removal.

The reason interviewers ask: upgrading from Java 8 to 11 is where these removals actually bite teams, so mentioning that you would add the JAXB dependencies as external libraries during such a migration shows real upgrade experience rather than release-note recall.

Q8. How is Java 11's Files API more convenient?

Java 11 added Files.readString(Path) and Files.writeString(Path, CharSequence), letting you read or write an entire file as a String in one call, without manually wiring up readers, writers or streams for small files.

Path path = Path.of("notes.txt");
Files.writeString(path, "hello world");
String content = Files.readString(path);   // whole file as a String, one line

The caveat worth adding: these load the whole file into memory, so they are for small-to-moderate files; large files still call for streaming with Files.lines or a buffered reader. Knowing that boundary is what turns a feature list into a judgement answer.

How to prepare

Do not memorize a bullet list — write a tiny program that makes an HTTP call with the new client, strips some Unicode whitespace, and reads a file with readString. Having run the code is what lets you answer follow-ups confidently. Then place Java 11 in the timeline: it is the LTS after Java 8, and the Java 17 features questions cover what came next, while the string handling set deepens the String methods introduced here. Rehearse framing each feature as "here is the problem it solved," and pressure-test that framing in a mock interview.

Frequently Asked Questions

Why is Java 11 considered important?
Java 11 is a Long-Term-Support (LTS) release, so many organizations standardized on it for years and it remains a common baseline in production. It also standardized the HttpClient, removed some bundled modules like Java EE and CORBA, and added everyday String and Files conveniences.
What is the new HttpClient in Java 11?
It is a modern, standardized HTTP client in java.net.http that supports HTTP/2, WebSocket, and both synchronous and asynchronous requests with a builder API. It replaced the old HttpURLConnection and removed the need for a third-party library for basic HTTP calls.
Can you run a Java file without compiling it first in Java 11?
Yes. Single-file source-code execution lets you run 'java Hello.java' directly; the launcher compiles it in memory and runs it. It is meant for scripts and learning, not for multi-file production applications.
What new String methods did Java 11 add?
isBlank(), strip(), stripLeading(), stripTrailing(), lines(), and repeat(int). strip() is Unicode-aware unlike trim(), isBlank() detects whitespace-only strings, lines() streams the lines of a multi-line string, and repeat() repeats a string efficiently.
Is Java 11 still relevant given newer LTS releases?
Yes. Many enterprise systems still run on Java 11, and interviewers often ask about it as a baseline before discussing what later versions added. Knowing what arrived in 11 versus 17 or 21 shows you understand how the language evolved.

Want to Build Your Career in Java Full Stack with AI?

Join CodeBegun and train with working industry engineers — View the Java Full Stack curriculum

Apply for Demo Class →
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 16 July 2026 LinkedIn
Chat with us