public class Exception
extends Throwable
The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch.
异常.可以通过e.printStackTrace()打印堆栈信息,判断错误的具体情况.
public class test{
// some methods
public static void main(String[] args){
test t = new test();
try{
//do something
}catch(Exception e){
//如果上面的处理过程中有错误,可能就会出异常
e.printStackTrace();
//从异常信息,可以知道具体的那个方法,哪一行出了问题.....
}
}
}
extends Throwable
The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch.
异常.可以通过e.printStackTrace()打印堆栈信息,判断错误的具体情况.
public class test{
// some methods
public static void main(String[] args){
test t = new test();
try{
//do something
}catch(Exception e){
//如果上面的处理过程中有错误,可能就会出异常
e.printStackTrace();
//从异常信息,可以知道具体的那个方法,哪一行出了问题.....
}
}
}
jvm自动向用户发送一个错误信息的消息类,编程时必须截获
这个错误消息并做出相应的处理动作。否则程序就会编译不通过
或者在运行过程中终止。