我是新手,求各位前辈,大牛教下我,万分感谢!希望能给我一些详细解说,在此谢谢了
package com.eric.exception;
public class RethrowException {
public static void main(String[] args) {
try {
// g0();
// g1();
// g2();
// g3();
g6();
} catch (Exception e) {......<br/><strong>答案就在这里:</strong><a target='_blank' rel='nofollow' href='http://blog.csdn.net/sun7545526/article/details/7110017'>java中异常处理的几种方式</a><br/>----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。
第一种:public String list()throw Exception{}
第二种:public String list(){
try{
}
catch(Exception e){
e.printStack();
}
}
第三种:public String list(){
try{
}
catch(Exception e){
throw new AdminContantsException("抛出自定义异常",e)
}
}
1.抛出异常
2.捕捉异常,抛出自定义提示异常