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

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

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

面接準備

模擬試験

ホームページに設定

このページをブックマーク

メールアドレスを登録

Java 17 面接の質問と回答

関連する比較

Java 16 vs Java 17Java 17 vs Java 18

質問 16. What is Switch Pattern Matching in Java 17?

It makes switch statements and expressions more flexible and expressive by letting patterns appear in case labels. It also makes it possible to relax the switch's null-hostility when needed.

There are two main patterns, which are as follows:

  • Guarded pattern: Uses pattern && boolean expression to refine further.
  • Pattern between parentheses

static record Human (String name, int age, String profession) {}

public String checkValue(Object obj) {
    return switch (obj) {
        case Human h -> "Name: %s, age: %s and profession: %s".formatted(h.name(), h.age(), h.profession());
        case Circle c -> "This is a circle";
        case Shape s -> "It is just a shape";
        case null -> "It is null";
        default -> "It is an empty";
    };
}

public String checkShape(Shape shape) {
    return switch (shape) {
        case Triangle t && (t.getNumberOfSides() != 3) -> "This is a weird triangle";
        case Circle c && (c.getNumberOfSides() != 0) -> "This is a weird circle";
        default -> "Just a normal shape";
    };
}

役に立ちましたか? コメントを追加 コメントを見る
 

質問 17. What is Generate sealed Classes in Java 17?

Adds sealed classes and interfaces to the Java language to make it better. Sealed classes and interfaces limit other classes, and interfaces can extend and implement them, respectively.

Showing some other progress to pattern matching along with the JEP 406 will make it possible to check the type, cast, and act code pattern more sophisticatedly and cleanly.

public abstract sealed class Subjects  

permits English, Maths, Science {...}  

役に立ちましたか? コメントを追加 コメントを見る
 

質問 18. Where can we download Java 17?

You can download Java 17 from the Oracle website: https://www.oracle.com/java/technologies/downloads/#java17

役に立ちましたか? コメントを追加 コメントを見る
 

質問 19. Provide an example of Vector API update in Java 17.

The example is as follows:

public void newVectorComputation(float[] a, float[] b, float[] c) {
    for (var i = 0; i < a.length; i += SPECIES.length()) {
        var m = SPECIES.indexInRange(i, a.length);
        var va = FloatVector.fromArray(SPECIES, a, i, m);
        var vb = FloatVector.fromArray(SPECIES, b, i, m);
        var vc = va.mul(vb);
        vc.intoArray(c, i, m);
    }
}

public void commonVectorComputation(float[] a, float[] b, float[] c) {
    for (var i = 0; i < a.length; i ++) {
        c[i] = a[i] * b[i];
    }
}

役に立ちましたか? コメントを追加 コメントを見る
 

質問 20. What is the next LTS version after Java 17?

The next LTS (Long Time Support) version is Java 21 and is released in September 2023.

役に立ちましたか? コメントを追加 コメントを見る
 

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

著作権 © 2026、WithoutBook。