题目内容
写出以下程序的运行结果:class MyException extends Exception{public String toString( ){ return "negative"; }}public class ExceptionDemo{public static void mySqrt(int a) throws MyException {if( a<0 ) throw new MyException();System.out.println(Math.sqrt(a));}public static void main( String args[] ){try{ mySqrt(25); mySqrt(-5); }catch( MyException e ){ System.out.println("Caught "+e); }}}
查看答案
搜索结果不匹配?点我反馈