人気の面接質問と回答・オンラインテスト
面接対策、オンラインテスト、チュートリアル、ライブ練習のための学習プラットフォーム

集中型学習パス、模擬テスト、面接向けコンテンツでスキルを伸ばしましょう。

WithoutBook は、分野別の面接質問、オンライン練習テスト、チュートリアル、比較ガイドをひとつのレスポンシブな学習空間にまとめています。

面接準備
ホーム / 面接科目 / Java 21
WithoutBook LIVE 模擬面接 Java 21 関連する面接科目: 39

Interview Questions and Answers

Java 21 の人気面接質問と回答を確認し、新卒者や経験者が就職面接の準備を進められます。

合計 21 問 Interview Questions and Answers

面接前に確認しておきたい最高の LIVE 模擬面接

Java 21 の人気面接質問と回答を確認し、新卒者や経験者が就職面接の準備を進められます。

Interview Questions and Answers

質問を検索して回答を確認できます。

経験者 / エキスパート向けの質問と回答

質問 1

What are Unnamed Classes in Java 21?

In Java, unnamed modules and packages are a familiar concept. When we do not create a module-info.java class then the module is automatically assumed by the compiler. Similarly, if we do not add the package statement in the class in the root directory, the class just compiles and runs fine.

Same way, we can now create unnamed classes. Quite obviously, an unnamed class is a class without a name.

Example:

// Prior to Java 21

public class TestAConcept {

  public static void main(String[] args) {

    System.out.println(method());

  }

  static String method() {

    //...

  }

}

From Java 21, we can write the above class without the class declaration as follows. It removes the class declaration, public and static access modifiers etc. to have a cleaner class.

// In Java 21

void main(String[] args) {

  System.out.println(method());

}

String method() {

  //...

}

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 2

What are the Scoped Values in Java 21?

If you are familiar with ThreadLocal variables, the scoped values are a modern way of sharing data within and across threads. Scoped values allow a value (object) to be stored for a limited time in such a way that only the thread that wrote the value can read it.

Scoped values are usually created as public static fields so we can access them directly without passing them as a parameter to any method. However, it is important to understand that if the value is checked in multiple methods, the current value will depend on the execution time and state of the thread. The value may change over time when accessed over time in different methods.

To create scoped values, use the ScopedValue.newInstance() factory method.

public final static ScopedValue<USER> LOGGED_IN_USER = ScopedValue.newInstance();

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 3

Provide an example of Scoped Values in Java 21.

To create scoped values, use the ScopedValue.newInstance() factory method.

public final static ScopedValue<USER> LOGGED_USER = ScopedValue.newInstance();

With ScopedValue.where(), we bind the scoped value to the object instance; and then we run a method, for whose call duration the scoped value should be valid. Note that a scoped value is written once and is then immutable, thus nobody can change the loggedInUser in the invoked method.

class LoginUtil {
 
public final static ScopedValue<USER> LOGGED_USER = ScopedValue.newInstance();
 
  //Inside some method
  User loggedInUser = authenticateUser(request);
  ScopedValue.where(LOGGED_USER, loggedInUser).run(() -> service.getData());
}

Inside the invoked thread, we can directly access the scoped value:

public void getData() {
 
  User loggedInUser = LoginUtil.LOGGED_USER.get();
  //use loggedUser
}
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 4

What is Structured Concurrency in Java 21?

The structured concurrency feature aims to simplify Java concurrent programs by treating multiple tasks running in different threads (forked from the same parent thread) as a single unit of work. Treating all such child threads as a single unit will help in managing all threads as a unit; thus, canceling and error handling can be done more reliably.

In structured multi-threaded code, if a task splits into concurrent subtasks, they all return to the same place i.e., the task’s code block. This way, the lifetime of a concurrent subtask is confined to that syntactic block.

In this approach, subtasks work on behalf of a task that awaits their results and monitors them for failures. At run time, structured concurrency builds a tree-shaped hierarchy of tasks, with sibling subtasks being owned by the same parent task. This tree can be viewed as the concurrent counterpart to the call stack of a single thread with multiple method calls.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 5

Provide an example of Structured Concurrency in Java 21.

In this approach, subtasks work on behalf of a task that awaits their results and monitors them for failures. At run time, structured concurrency builds a tree-shaped hierarchy of tasks, with sibling subtasks being owned by the same parent task. This tree can be viewed as the concurrent counterpart to the call stack of a single thread with multiple method calls.

try (var scope = new StructuredTaskScope.ShutdownOnFailure()()) {
 
    Future<AccountDetails> accountDetailsFuture = scope.fork(() -> getAccountDetails(id));
    Future<LinkedAccounts> linkedAccountsFuture = scope.fork(() -> fetchLinkedAccounts(id));
    Future<DemographicData> userDetailsFuture = scope.fork(() -> fetchUserDetails(id));
 
    scope.join(); // Join all subtasks created
    scope.throwIfFailed(e -> new WebApplicationException(e));
 
    //The subtasks have completed by now so process the result
    return new Response(accountDetailsFuture.resultNow(), 
    linkedAccountsFuture.resultNow(),
    userDetailsFuture.resultNow());
}
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 6

Please provide some details on GraalVM for JDK 21.

GraalVM for JDK 21 binaries are free to use in production and free to redistribute, at no cost, under the GraalVM Free Terms and Conditions (GFTC).

GraalVM for JDK 21 will receive updates under the GFTC, until September 2026, a year after the release of the next LTS. Subsequent updates of GraalVM for JDK 21 will be licensed under the GraalVM OTN License Including License for Early Adopter Versions (GOTN) and production use beyond the limited free grants of the GraalVM OTN license will require a fee.

Oracle GraalVM uses the Graal just-in-time compiler and includes the Native Image feature as optional early adopter technology.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 7

Where can we download GraalVM for JDK 21?

You can download GraalVM for JDK 21 from Oracle website: Download GraalVM for JDK 21

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 8

How to work with GraalVM for Java 21?

Please check the details here on GraalVM for Java 21:

GraalVM for Java 21

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る

ユーザー評価で最も役立つ内容:

著作権 © 2026、WithoutBook。