题目内容
请写出下面程序的运行结果classMyExceptionextendsException{publicStringtoString(){return"negative";}}publicclassExceptionDemo{publicstaticfloatmySqrt(inta)throwsMyException{if(a<0)thrownewMyException();elsereturn Math.sqrt(a);}publicstaticvoidmain(Stringargs[]){try{mySqrt(-5);}catch(MyExceptione){System.out.println("Caught"+e);}}}
查看答案
搜索结果不匹配?点我反馈