file 有两个方法,一个是file.canExecute(),一个是file.createNewFile(),两个的定义都是要throws 某种exception 出来,为啥我打出file.createNewFile()时,eclipse显示出错,需要我加异常处理语句但是System.out.println(file.canExecute());这个却没有报错,为啥?求教。
调试欢乐多
public boolean canExecute() throws SecurityException而:
SecurityException extend RuntimeException
那么你就清楚了,RuntimeException是可以不需要catch滴。
但是System.out.println(file.canExecute());这个却没有报错
--前句话和后句话有因果关系吗?