日期:2014-05-20 浏览次数:20721 次
class VeryImportantException extends Exception{ public String toString(){ return "A very important exception!"; } } class HoHumException extends Exception { public String toString(){ return "A trivial exception"; } } public class Te{ void f() throws VeryImportantException{ throw new VeryImportantException(); } void dispose() throws HoHumException{ throw new HoHumException (); } public static void main void main(String[] args)throws Exception{ Te te = new Te(); try{ te.f(); }finally{ te.dispose(); } } }
class VeryImportantException extends Exception{ public String toString(){ return "A very important exception!"; } } class HoHumException extends Exception { public String toString(){ return "A trivial exception"; } } public class Te{ void f() throws VeryImportantException{ throw new VeryImportantException(); } void dispose() throws HoHumException{ throw new HoHumException (); } public static void main (String[] args)throws Exception{ Te te = new Te(); try{ te.f(); }finally{ te.dispose(); } } }
------解决方案--------------------
明显的代码错误
public static void main void main(String[] args)
------解决方案--------------------
public static void main void main(String[] args)
------解决方案--------------------
public static void main void main(String[] args)throws Exception
两个void main 啊
------解决方案--------------------
这个貌似在考验大家的仔细度,多了一个void main ,楼主写代码要仔细点哦。
------解决方案--------------------