[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/Snailclimb/JavaGuide/main/docs/java/new-features/java17.md [Back]  [Original]

---
title: Java 17JDK 17switch  API
description: Java 17JDK 17switch  API API LTS 
category: Java
tag:
  - Java
head:
  - - meta
    - name: keywords
      content: Java 17,JDK 17,JDK17,Java17,LTS,,switch, API, API,JEP
---

Java 17JDK 17 2021  9  14  Oracle LTS

 Oracle 2026  4  Java SE Oracle JDK 17  Premier Support  2026  9 Extended Support  2029  9  JDK 

![](https://oss.javaguide.cn/github/javaguide/java/new-features/4c1611fad59449edbbd6e233690e9fa7.png)

 JDK 11  JDK 17 switch  API JDK  API Spring 6.x  Spring Boot 3.x  Java  Java 17

JDK 17  14 

- [JEP 356: Enhanced Pseudo-Random Number Generators](https://openjdk.java.net/jeps/356)
- [JEP 398: Deprecate the Applet API for Removal Applet API ](https://openjdk.java.net/jeps/398)
- [JEP 406: Pattern Matching for switch (Preview)switch ](https://openjdk.java.net/jeps/406)
- [JEP 407: Remove RMI Activation RMI ](https://openjdk.java.net/jeps/407)
- [JEP 409: Sealed Classes](https://openjdk.java.net/jeps/409)
- [JEP 410: Remove the Experimental AOT and JIT Compiler AOT  JIT ](https://openjdk.java.net/jeps/410)
- [JEP 411: Deprecate the Security Manager for Removal](https://openjdk.java.net/jeps/411)
- [JEP 412: Foreign Function & Memory API (Incubator) API](https://openjdk.java.net/jeps/412)
- [JEP 414: Vector API (Second Incubator) API](https://openjdk.java.net/jeps/414)

 JDK 8  JDK 16 

![](https://oss.javaguide.cn/github/javaguide/java/new-features/jdk8~jdk24.png)

[OpenJDK Java 17 ](https://openjdk.java.net/projects/jdk/17/)

## JEP 356: Enhanced Pseudo-Random Number Generators

JDK 17  `Random``ThreadLocalRandom`  `SplittableRandom`  3 

Java 17 pseudorandom number generatorPRNG PRNG 

> [PRNG](https://ctf-wiki.org/crypto/streamcipher/prng/intro/) PRNG PRNG 



```java
RandomGeneratorFactory l128X256MixRandom = RandomGeneratorFactory.of("L128X256MixRandom");
// 
RandomGenerator randomGenerator = l128X256MixRandom.create(System.currentTimeMillis());
// 
randomGenerator.nextInt(10);
```

## JEP 398: Deprecate the Applet API for Removal Applet API 

Applet API  Web  Java 

Applet API  Java 9 [JEP 289](https://openjdk.java.net/jeps/289)

## JEP 406: Pattern Matching for switchswitch 

 `instanceof`  `switch` 

`instanceof` 

```java
// Old code
if (o instanceof String) {
    String s = (String)o;
    ... use s ...
}

// New code
if (o instanceof String s) {
    ... use s ...
}
```

`switch` 

```java
// Old code
static String formatter(Object o) {
    String formatted = "unknown";
    if (o instanceof Integer i) {
        formatted = String.format("int %d", i);
    } else if (o instanceof Long l) {
        formatted = String.format("long %d", l);
    } else if (o instanceof Double d) {
        formatted = String.format("double %f", d);
    } else if (o instanceof String s) {
        formatted = String.format("String %s", s);
    }
    return formatted;
}

// New code
static String formatterPatternSwitch(Object o) {
    return switch (o) {
        case Integer i -> String.format("int %d", i);
        case Long l    -> String.format("long %d", l);
        case Double d  -> String.format("double %f", d);
        case String s  -> String.format("String %s", s);
        default        -> o.toString();
    };
}

```

 `null` 

```java
// Old code
static void testFooBar(String s) {
    if (s == null) {
        System.out.println("oops!");
        return;
    }
    switch (s) {
        case "Foo", "Bar" -> System.out.println("Great");
        default           -> System.out.println("Ok");
    }
}

// New code
static void testFooBar(String s) {
    switch (s) {
        case null         -> System.out.println("Oops");
        case "Foo", "Bar" -> System.out.println("Great");
        default           -> System.out.println("Ok");
    }
}
```

## JEP 407: Remove RMI Activation RMI 

 (RMI)  RMI RMI 

## JEP 409: Sealed Classes

 [JEP 360](https://openjdk.java.net/jeps/360)  Java 15  JDK 16   [JEP 397](https://openjdk.java.net/jeps/397) 

 [Java 14 & 15 ](./java14-15.md) 

## JEP 410: Remove the Experimental AOT and JIT Compiler AOT  JIT 

 Java 9  [JEP 295](https://openjdk.java.net/jeps/295) , (AOT)  Java 

Java 17 (AOT)  (JIT)  Java  JVM  (JVMCI) JIT 

## JEP 411: Deprecate the Security Manager for Removal



 Java 1.0 Java  Java Java 17  Applet API ( [JEP 398](https://openjdk.java.net/jeps/398) ) 

## JEP 412: Foreign Function & Memory API API

Java  API  Java  JVM  JVM  API  Java  JNI 

 API  Java 17  [JEP 412](https://openjdk.java.net/jeps/412) [JEP 419](https://openjdk.org/jeps/419)  Java 18  [JEP 424](https://openjdk.org/jeps/424)  Java 19 

 [Java 19 ](./java19.md)  API

## JEP 414: Vector API API

Vector API  [JEP 338](https://openjdk.java.net/jeps/338) [ API](http://openjdk.java.net/jeps/11) Java 16  [JEP 414](https://openjdk.java.net/jeps/414)  Java 17  [JEP 417](https://openjdk.java.net/jeps/417)  Java 18  [JEP 426](https://openjdk.java.net/jeps/426)  Java 19 

 API  API  CPU SIMD CPU  HotSpot  API  Java 

 [Java 18 ](./java18.md)  API



Web Proxy Viewer  |  New URL  |  Original Page