第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

test1拋出異常時(shí)出現(xiàn)“DrunkException cannot be resolved to a type”是什么原因

test1拋出異常時(shí)出現(xiàn)“DrunkException cannot be resolved to a type”是什么原因

慕粉3537498 2016-06-21 18:27:03
查看完整描述

3 回答

已采納
?
yanrun

TA貢獻(xiàn)317條經(jīng)驗(yàn) 獲得超240個(gè)贊

看異常應(yīng)該是你沒有定義DrunkExcpetion類,或者沒有引入

public?void?test1()throws?DrunkException?{
?throw?new?DrunkException("喝車別開酒");
}

沒有必要即在方法中拋出異常又聲明這個(gè)方法會(huì)拋出異常,可以改成

public?void?test1()?{
?throw?new?DrunkException("喝車別開酒");
}


查看完整回答
1 反對(duì) 回復(fù) 2016-06-21
?
慕粉3537498

TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊

public class Test2 {
public static void main(String[] args){
?Test2 tes = new Test2();
?try{
??tes.test2();
?}catch(Exception e){
??e.printStackTrace();
?}
?
}
public void test1()throws DrunkException {
?throw new DrunkException("喝車別開酒");
?
}
public void test2(){
?try{
?test1();
?}catch(Exception e){
??e.printStackTrace();
??RuntimeException? Exc = new RuntimeException("司機(jī)一滴酒,親人兩行淚");
??Exc.initCause(e);
??throw Exc;
??
?}
}
}


“public void test1()throws DrunkException {
?throw new DrunkException("喝車別開酒");
?
}”這一塊報(bào)錯(cuò)的

查看完整回答
反對(duì) 回復(fù) 2016-06-21
?
_瀟瀟暮雨

TA貢獻(xiàn)646條經(jīng)驗(yàn) 獲得超225個(gè)贊

可否貼下代碼?

查看完整回答
反對(duì) 回復(fù) 2016-06-21
  • 3 回答
  • 0 關(guān)注
  • 1779 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)