异常什么时候抛出?
2007-05-26 16:20
197 查看
class ExceptionTest{
public static void throwMe(){
throw new RuntimeException();
}
public static void main(String[] args){
ExceptionTest et=new ExceptionTest();
try{
System.out.println("start");
et.throwMe();
System.out.println("wrong");
}finally{
System.out.println("end");
}
}
}
//如果没有catch异常,那么肯定在finally执行完之后系统才会抛出异常,需要注意!
public static void throwMe(){
throw new RuntimeException();
}
public static void main(String[] args){
ExceptionTest et=new ExceptionTest();
try{
System.out.println("start");
et.throwMe();
System.out.println("wrong");
}finally{
System.out.println("end");
}
}
}
//如果没有catch异常,那么肯定在finally执行完之后系统才会抛出异常,需要注意!
相关文章推荐
- (转)什么时候要抛出异常?
- 什么时候抛出/捕获异常?
- 什么时候处理与抛出异常
- (转)什么时候要抛出异常?
- 什么时候要抛出异常?
- 什么时候要抛出异常?
- hibernate什么时候会抛出懒加载的异常
- 什么时候要抛出异常
- 黑马程序员——面向对象(继承+抛出异常)-第20天
- 报异常抛出InvocationTargetException的解决方法
- Java 面向对象:抛出异常throw、throws
- 将Controller抛出的异常转到特定View
- Nhibernate 抛出异常 System.Collections.Generic.KeyNotFoundException 给定关键字不在字典中
- JAVA之设计方法boolean prime(int n),判断是否为素数,并抛出异常
- JAVA语言如何进行异常处理,关键字:throws,throw,try,catch,finally分别代表什么意义?在try块中可以抛出异常吗
- throw 是语句抛出一个异常;throws 是方法抛出一个异常
- 在多线程中抛出的异常出错?
- java基础16 捕获、抛出以、自定义异常和 finally 块(以及关键字:throw 、throws)
- Eclipse抛出GC overhead limit exceeded异常问题
- thread"main"java.lang.NoClassDefFoundError:ServerProgram.java 抛出异常~