填空题

在下列程序的下划线处,填入适当语句使程序能正确执行并输出异常栈信息。 public class Throwable Exception{ public static voidmain(Stringargs[i]{ try{ thrownewThrowable("异常"); }catch(Throwablee){ System.out.println("CaughtThrowable"); System.out.println("e.getMessage():"+e.getMessage()); System.out.println("e.toString():"+e.toString()); System.out.println("e.printStackTrace():"); ;}}}

【参考答案】

e.printStackTrace0或e.primStackTrace(System.out)
热门 试题