码迷,mamicode.com
首页 > 其他好文 > 详细

throw和throws子句的区别

时间:2014-07-06 11:59:35      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:style   java   color   for   io   size   

import java.io.IOException


public class ThrowDemo{

public static void processFile(String toFile) throws IOException

{

//Omitted implementation propagates all

//throw  IOException back to the caller

}

public static void main(String[] args){

for(String fileName:args){

try{

processFile(fileName);

}

catch(IOException e){

System.out.println(e);

}

}

}

小结:

throw子句用于抛出异常‘

throws子句用于传播异常



throw和throws子句的区别,布布扣,bubuko.com

throw和throws子句的区别

标签:style   java   color   for   io   size   

原文地址:http://blog.csdn.net/hephec/article/details/37063211

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!