JDK17的新特性

2024-04-22

switch

jdk17的预览特性:switch的模式匹配,需要使用--enable-previe以启用
Object o = new String();
String result = switch (o) {
	case Integer i:
		yield "int " + i;
	case String s:
		yield "String " + s;
	default -> {
		yield o.toString();
	}
};

标记删除Applet API

{/if}