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

為了賬號安全,請及時綁定郵箱和手機立即綁定

Eclipse沒有顯示錯誤,卻運行不了

(class 1:)

package com.imooc.test;


public class DrunkException extends Exception {


public DrunkException(){

}

public DrunkException(String message){

super(message);

}

}


(Class 2:)

package com.imooc.test;


public class ChainTest {


/**

* test1():拋出“喝大了”異常

* test2():嘗試捕獲“喝大了”異常,并且包裝成運行時異常,繼續(xù)拋出

* main方法中,調(diào)用test2(),嘗試捕獲test2()方法拋出的異常

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

ChainTest ab=new ChainTest();

//use the try-catch to surround the test2()

try {

ab.test2();

}catch(Exception e){

e.printStackTrace();

}

}

?

public void test1() throws DrunkException{

throw new DrunkException("開車別喝酒");

}

?

public void test2() {

try {

test1();

} catch (DrunkException e) {

//新建一個RuntimeException的方法,并將捕獲的異常傳遞給它

RuntimeException newExc=?

new RuntimeException("司機一滴酒,親人兩行淚");

//newExc.initCause(e);

throw newExc;

}

}

}

運行結(jié)果:

http://img1.sycdn.imooc.com//5aa8eb110001404e13660736.jpg

請問這是什么問題呢???

正在回答

4 回答

The public type DrunkException must be defined in its own file.是必須在自己的文件中定義公共類型DunkExcExchange。


The serializable class DrunkException does not declare a static final serialVersionUID field of type long是可序列化類DunkExct不聲明靜態(tài)最終序列。


我百度的,這時候重啟一下應(yīng)該是最好的吧

0 回復 有任何疑惑可以回復我~

Erroe錯誤是你系統(tǒng)崩潰了

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

慕無忌1424581 提問者

謝謝回答,現(xiàn)在程序顯示的錯誤是: The serializable class DrunkException does not declare a static final serialVersionUID field of type long. The public type DrunkException must be defined in its own file. 請問你知道這個兩個錯誤是什么意思嗎?
2018-03-23 回復 有任何疑惑可以回復我~

控制臺里面的紅色是報錯了了吧

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

慕無忌1424581 提問者

那是其他程序的。我提問中的程序根本跑不了,沒有結(jié)果和錯誤提示...
2018-03-21 回復 有任何疑惑可以回復我~

不知道哎

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

Eclipse沒有顯示錯誤,卻運行不了

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

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