首页 > 其他 > 详细

学习笔记02 异常处理

时间:2015-11-27 17:28:54      阅读:138      评论:0      收藏:0      [点我收藏+]
抛异常分为两种方式,一种是抛出异常就处理异常就是所谓的try{}catch(){},还有一种就是IOException回避异常,就是在出现异常时不处理,在调用此方法时处理该异常,什么时候调用,什么时候处理异常。

import java.io.*;
public class Ex6_2 {

/**
* @param args
*/
public static void main(String[] args)throws IOException{
// TODO Auto-generated method stub
String fileName="D:/Hello.txt";
BufferedWriter out=new BufferedWriter(new FileWriter(fileName));
out.write("Hello!");
out.newLine();
out.write("This is another text file using BufferedWriter,");
out.newLine();
out.write("So I can use a common way to start a newline");
out.close();
}
}

学习笔记02 异常处理

原文:http://www.cnblogs.com/kalinda/p/5000749.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!