1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-08-01 16:28:03 +08:00

Update Java基础知识.md

This commit is contained in:
guide 2021-04-14 23:46:54 +08:00
parent 70b8d306a4
commit 67d52a2525

View File

@ -1295,7 +1295,7 @@ public class Test {
#### 3.2.4. 使用 `try-with-resources` 来代替`try-catch-finally` #### 3.2.4. 使用 `try-with-resources` 来代替`try-catch-finally`
1. **适用范围(资源的定义):** 任何实现 `java.lang.AutoCloseable`或者 `java.io.Closeable` 的对象 1. **适用范围(资源的定义):** 任何实现 `java.lang.AutoCloseable`或者 `java.io.Closeable` 的对象
2. **关闭资源和 final 的执行顺序:** 在 `try-with-resources` 语句中,任何 catch 或 finally 块在声明的资源关闭后运行 2. **关闭资源和 finally 的执行顺序:** 在 `try-with-resources` 语句中,任何 catch 或 finally 块在声明的资源关闭后运行
《Effecitve Java》中明确指出 《Effecitve Java》中明确指出