jdk1.7 try-with-resource
来源:互联网 发布:淘宝双11销售额 编辑:程序博客网 时间:2024/06/16 11:52
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
public class AutoCloseblePractice {
public static void main(String[] args) {
try ( A a = new A() )
{
a.doSome();
} catch (Exception e) {
System.out.println("213");
} finally{
}
}
}
class A implements AutoCloseable {
public void doSome() {
System.out.println("dosome");
}
public void close() throws Exception {
// TODO Auto-generated method stub
System.out.println("close");
}
import java.io.FileInputStream;
import java.io.InputStreamReader;
public class AutoCloseblePractice {
public static void main(String[] args) {
try ( A a = new A() )
{
a.doSome();
} catch (Exception e) {
System.out.println("213");
} finally{
}
}
}
class A implements AutoCloseable {
public void doSome() {
System.out.println("dosome");
}
public void close() throws Exception {
// TODO Auto-generated method stub
System.out.println("close");
}
}
阅读全文
0 0
- jdk1.7 try-with-resource
- java7 try-with-resource
- Java-try-with-resource
- try-with-resource
- java中try-with-resource
- jdk1.7中try-with-resources语法糖详解
- JDK1.7新特性-try-with-resources语句
- Jdk1.7(及以上) 使用 try-with-resources 替代try-catch-finally
- java7中try-with-resource语法
- 深入理解Java try-with-resource
- 深入理解Java%20try-with-resource/
- 深入理解 Java 中的 try-with-resource
- Java新特性-try-with-resource
- 使用Java中的Try-With-Resource
- 深入理解 Java 中的 try-with-resource
- jdk1.7新特性try(){}
- JDK1.7新特性之try-with-resources和catch多种异常
- 使用try-with-resource改进代码异常处理机制
- <PTA>一元多项式的求和和乘积运算解题报告
- LeetCode编程练习
- 关于<a></a>标签里嵌套<a></a>标签的bug
- CSS3新增特性
- 3.MongoDB数据查询
- jdk1.7 try-with-resource
- loadrunner Web_类函数之web_save_header()
- 【mysql】事务 运行原理 概述
- 文章标题 coderforces 609E : Minimum spanning tree for each edge (MST+LCA)
- C语言基础数据类型与运算符号复习记录
- 弹出框
- 读书笔记-《Java NIO》:第三章 通道(4)
- 【LeetCode算法练习(C++)】Roman to Integer
- Xcode(8.3.3)编辑时闪退