程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于10,使用throw语句显式地引发异常,异常输出信息为“something’s wrong!”, 语句为()。 A、if ( i 10 ) throw Exception(“something’s wrong!”);B、if ( i 10 ) throw Exception e (“something’s wrong!”);C、if ( i 10 ) throw new Exception(“something’s
题目
程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于10,使用throw语句显式地引发异常,异常输出信息为“something’s wrong!”, 语句为()。
- A、if ( i > 10 ) throw Exception(“something’s wrong!”);
- B、if ( i > 10 ) throw Exception e (“something’s wrong!”);
- C、if ( i > 10 ) throw new Exception(“something’s wrong!”);
- D、if ( i > 10 ) throw new Exception e ("something’s wrong!");