JAVA
文章平均质量分 85
Olivia851
这个作者很懒,什么都没留下…
展开
-
Java之Throwable.addSuppressed()是什么
使用Java7新语法try-with-resources时,查看编译文件时头次接触到addSuppressed()方法,特此记录测试理解过程。资源类:【特意加了异常,以便测试】public class Panda implements AutoCloseable{ public Panda(){ System.out.println("Panda was born;"); } @Override public void close() throws Exc原创 2021-11-03 18:52:22 · 1084 阅读 · 0 评论 -
Java之try-with-resources
Java之try-with-resources最近做了一个下载文件的接口,实现过程中一直频繁的try-catch-finally,最后在用SonarLint检测的时候,给我了提示:这是SonarLint里的规则简介:Try-with-resources should be used Java 7 introduced the try-with-resources statement, which guarantees that the resource in question will be转载 2021-11-03 17:45:53 · 2267 阅读 · 0 评论