为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我打完了出的结果不对啊

package com.H.test;

public class ChainTest {
    public static void main(String[] args) {
ChainTest ct=new ChainTest();
 try {
     ct.test2();
 }catch (Exception e){
     e.printStackTrace();
 }
    }
    public  void  test1()throws DrunkException{
        throw new RuntimeException("喝酒别开车!");
    }
    public void test2(){
        try {
            test1();
        } catch (DrunkException e) {
            RuntimeException newExc=new RuntimeException("司机一滴酒");
            newExc.initCause(e);
            throw newExc;
        }
    }
}


正在回答

1 回答

public  void  test1()throws DrunkException{
        throw new DrunkException("喝酒别开车!");
}


1 回复 有任何疑惑可以回复我~
#1

weixin_慕慕7498354 提问者

感谢大佬
2022-04-28 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为什么我打完了出的结果不对啊

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号