maxf 59a4adc568 [update] java12-example 示例完成
java13-example 示例完成
2025-08-15 17:03:31 +08:00

20 lines
644 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Java 12 新特性示例
本项目展示了Java 12的核心新特性及代码示例。
## 特性列表
### 1. Switch表达式预览功能JDK14正式添加
- **说明**:支持返回值的简化语法,使用`->`替代`:`,可直接赋值给变量
- **启用方式**:编译/运行时需添加`--enable-preview --source 12`
### 2. 文件差异对比
- **说明**:新增`Files.mismatch()`方法定位文件内容差异位置
### 3. Shenandoah垃圾回收器
- **说明**低延迟GC需在JVM参数启用`-XX:+UseShenandoahGC`
### 4. JVM常量API
- **说明**:通过`ClassDesc`等接口标准化访问JVM常量池