가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Prepare Interview

모의 시험

홈페이지로 설정

이 페이지 북마크

이메일 주소 구독
/ 면접 주제 / Java 15
WithoutBook LIVE Mock Interviews Java 15 Related interview subjects: 39

Interview Questions and Answers

Know the top Java 15 interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Total 16 questions Interview Questions and Answers

The Best LIVE Mock Interview - You should go through before interview

Know the top Java 15 interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Interview Questions and Answers

Search a question to view the answer.

Freshers / Beginner level questions & answers

Ques 1

What is Java 15?

Released on September 15, 2020.

There are a few new features and updates have been provided here:

The JDK class library, Text Blocks, performance changes, experimental, preview, and incubator features, deprecations and deletions, and finally, other changes that we rarely come into contact with.

But that's not all: A total of 14 JDK Enhancement Proposals (JEPs) have made it into this release.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 2

What is Text Blocks or Multi-line string in Java 15?

Until now, when we wanted to define a multi-line string in Java, it usually looked like this:

String sql =
" SELECT id, title, text\n"
+ " FROM Article\n"
+ " WHERE category = \"Java\"\n"
+ "ORDER BY title";

Starting with Java 15, we can notate this string as a "text block":

String sql = """
SELECT id, title, text
FROM Article
WHERE category = "Java"
ORDER BY title""";
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 4

What is String.formatted() in Java 15?

We could previously replace placeholders in a string as follows, for example:

String message =    String.format(        "User %,d with username %s logged in at %s.",        userId, username, ZonedDateTime.now());

Starting from Java 15, we can use an alternative syntax:

String message =    "User %,d with username %s logged in at %s."        .formatted(userId, username, ZonedDateTime.now());

It makes no difference which method you use. Both methods will eventually call the following code:

String message =    new Formatter()        .format(            "User %,d with username %s logged in at %s.",            userId, username, ZonedDateTime.now())        .toString();

So the choice is ultimately a matter of taste. I quickly made friends with the new spelling.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 5

What is String.translateEscapes() in Java 15?

Occasionally we get to deal with a string that contains escaped escape sequences, such as the following:

String s = "foo\\nbar\\tbuzz\\\\";System.out.println(s);

The output looks like this:

foo\nbar\tbuzz\\

Sometimes, however, we want to display the evaluated escape sequences: a newline instead of "\n", a tab instead of "\t", and a backslash instead of "\".

Until now, we had to rely on third-party libraries such as Apache Commons Text for this:

System.out.println(StringEscapeUtils.unescapeJava(s));

Starting from Java 15, we can avoid the additional dependency and use the JDK method String.translateEscapes():

System.out.println(s.translateEscapes());

The output now reads:

foobar     buzz
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 6

What is CharSequence.isEmpty() in Java 15?

Also new is the default method isEmpty() in the CharSequence interface. The method simply checks whether the character sequence's length is 0:

default boolean isEmpty() {  return this.length() == 0;}

This method is thus automatically available in the Segment, StringBuffer, and StringBuilder classes.

String and CharBuffer, which also implement CharSequence, each have their optimized implementation of isEmpty(). With String, for example, the call to length() is unnecessarily expensive because, since Java 9 (JEP 254 "Compact Strings"), the string's encoding must also be taken into account when calculating its length.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments

Intermediate / 1 to 5 years experienced level questions & answers

Ques 8

What is the Garbage Collector ZGC + Shenandoah in Java 15?

The requirements for modern applications are becoming increasingly demanding. With memory requirements ranging from gigabytes to terabytes, they may have to achieve response times in the single-digit millisecond range.

Conventional garbage collectors (such as the allrounder G1) with stop-the-world phases of a hundred milliseconds and more are not optimally suited to such requirements.

Aiming to eliminate stop-the-world pauses as much as possible (by doing most of the work in parallel with the running application), or at least reduce them to a few milliseconds, Oracle and RedHat have developed two new garbage collectors that have been shipped as preview features since Java 11 and 12, respectively.

As of Java 15, they are ready for productive use and will hopefully make the Java platform attractive to even more developers.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 9

What is String.stripIndent() in Java 15?

Suppose we have a multi-line string where each line is intended and has some trailing spaces, such as the following. We print each line, bounded by two vertical bars.

String html = """
<html> s
<body> s
<h1>Hello!</h1>
</body> s
</html> s
""";

html.lines()
.map(line -> "|" + line + "|")
.forEachOrdered(System.out::println);
Code language: Java (java)

As you learned in the first chapter, the alignment of a text block is based on the closing quotation marks. The output, therefore, looks like this:

|  <html>     |
| <body> |
| <h1>Hello!</h1>|
| </body> |
| </html> |

Using the stripIndent() method, we can remove the indentation and trailing spaces:

html.stripIndent()
.lines()
.map(line -> "|" + line + "|")
.forEachOrdered(System.out::println);

The output is now:

|<html>|
| <body>|
| <h1>Hello!</h1>|
| </body>|
|</html>|
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 10

What is the change of Helpful NullPointerExceptions in Java 15?

Helpful NullPointerExceptions, introduced in Java 14, are enabled by default in Java 15 and later.

"Helpful NullPointerExceptions" no longer only show us in which line of code a NullPointerException occurred, but also which variable (or return value) in the corresponding line is null and which method could therefore not be called.

You can find an example in the article linked above.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 11

What are Specialized Implementations of TreeMap Methods in Java 15?

In TreeMap, specialized methods putIfAbsent(), computeIfAbsent(), computeIfPresent(), compute(), and merge() were implemented.

These methods were only specified as default methods in the Map interface since Java 8.

The TreeMap-specific implementations are optimized for the underlying red-black tree; accordingly, they are more performant than the interface's default methods.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments

Experienced / Expert level questions & answers

Ques 13

What is ZGC: A Scalable Low-Latency Garbage Collector in Java 15?

The Z Garbage Collector, or ZGC, promises not to exceed pause times of 10 ms while reducing overall application throughput by no more than 15% compared to the G1GC (the reduction in throughput is the cost of low latency).

ZGC supports heap sizes from 8 MB up to 16 TB.

The pause times are independent of both the heap size and the number of surviving objects.

Like G1, ZGC is based on regions, is NUMA compatible and can return unused memory to the operating system.

You can configure ZGC with a "soft" heap upper limit (VM option -XX:SoftMaxHeapSize): ZGC will only exceed this limit if necessary to avoid an OutOfMemoryError.

To activate ZGC, use the following VM option:

-XX:+UseZGC

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 14

What is Shenandoah: A Low-Pause-Time Garbage Collector in Java 15?

Just like ZGC, Shenandoah promises minimal pause times, regardless of the heap size.

You can read about exactly how Shenandoah achieves this on the Shenandoah wiki.

You can activate Shenandoah with the following VM option:

-XX:+UseShenandoahGC

Just like G1 and ZGC, Shenandoah returns unused memory to the operating system after a while.

There is currently no support for NUMA and SoftMaxHeapSize; however, at least NUMA support is planned.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 15

What Is Biased Locking in Java 15?

Biased locking is an optimization of thread synchronization aimed at reducing synchronization overhead when the same monitor is repeatedly acquired by the same thread (i.e., when the same thread repeatedly calls code synchronized on the same object).

In the example above, this means that the first time the add() method is called, the vector monitor is biased to the thread in which the test method is executed. This bias speeds up the monitor's acquisition in the following 9,999,999 add() method calls.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 16

Why Was Biased Locking Disabled in Java 15?

Biased locking mainly benefits legacy applications that use data structures such as Vector, Hashtable, or StringBuffer, where each access is synchronized.

Modern applications usually use non-synchronized data structures such as ArrayList, HashMap, or StringBuilder – and the data structures optimized for multithreading in the java.util.concurrent package.

Because the code for biased locking is highly complex and deeply intertwined with the JVM code, it requires a great deal of maintenance and makes changes within the JVM's synchronization system costly and error-prone.

Therefore, the JDK developers decided in JDK Enhancement Proposal 374 to disable biased locking by default, mark it as "deprecated" in Java 15 and remove it entirely in one of the following releases.

복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments

Most helpful rated by users:

Copyright © 2026, WithoutBook.