“喝醉了”異常是老師之前就定義好的異常么?為何我自己寫的時候,提示“DrunkException cannot be resolved to a type”?
“喝醉了”異常是老師之前就定義好的異常么?為何我自己寫的時候,提示“DrunkException cannot be resolved to a type”?
“喝醉了”異常是老師之前就定義好的異常么?為何我自己寫的時候,提示“DrunkException cannot be resolved to a type”?
2016-07-29
舉報
2016-07-29
是老師自己定義的,要想使用需要自己定義:
2016-07-29
自定義異常繼承Exception,使用的時候,通過關鍵字throw 拋出,或者通過throws交給上一級出來,捕獲通過trycatch語句,捕獲異常。如果不在同一個包內,需要import