单选题程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于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’

题目
单选题
程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于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!);


相似考题
更多“单选题程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于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 w”相关问题
  • 第1题:

    Something' s gone wrong with the window; it_______ not shut.

    A、will

    B、shall

    C、would

    D、should


    正确答案:C

  • 第2题:

    Java程序中读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于10,使用throw语句显式地引发异常,异常输出信息为“something’swrong!”,语句为()。

    A.if(I>10)throw Exception(“something’swrong!”);

    B.if(I>10)throw Exceptione(“something’swrong!”);

    C.if(I>10)thrownew Exception(“something’swrong!”);

    D.if(I>10)thrownew Exceptione(“something’swrong!”);


    正确答案:C

  • 第3题:

    2号舱口处的起货机出故障了。()

    • A、There is something wrong with the derrick at hatch No.2.
    • B、There is something wrong with the derrick at hatch No.1.
    • C、There is something wrong with the winch at hatch No.2.
    • D、There is something wrong with the winch at hatch No.1.

    正确答案:C

  • 第4题:

    Which the statement is true?()

    • A、 The Error class is a Runtime Exception.
    • B、 No exceptions are subclasses of Error.
    • C、 Any statement that may throw an Error must be enclosed in a try block.
    • D、 any statement that may throw an Exception must be enclosed in a try block.
    • E、 Any statement that may throw an Runtime Exception must be enclosed in a try block.

    正确答案:B

  • 第5题:

    程序读入用户输入的一个值,要求创建一个异常,如果输入值大于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!”);

    正确答案:C

  • 第6题:

    假设有自定义异常类ServiceException,那么抛出该异常的语句正确的是哪项?() 

    • A、 raise ServiceException
    • B、 throw new ServiceException()
    • C、 throw ServiceException
    • D、 throws ServiceException

    正确答案:B

  • 第7题:

    class Birds {  public static void main(String [] args) {  try {  throw new Exception();  } catch (Exception e) { try {  throw new Exception();  } catch (Exception e2) { System.out.print("inner "); }  System.out.print("middle "); }  System.out.print("outer ");  }  }  结果为:()  

    • A、inner
    • B、inner outer
    • C、middle outer
    • D、inner middle outer

    正确答案:D

  • 第8题:

    单选题
    A: I can’t seem to find a color TV of the new model.  B: _______
    A

    Why don’t you try the new store on King’s Road?

    B

    There’s also something wrong with my TV set.

    C

    Don’t you know the new model you want is not on the market yet?

    D

    The new model is far more expensive than those old ones.


    正确答案: C
    解析:
    A方的话“我好像找不到那种新型号的彩电”表明了A方有买新彩电的打算,A项的答复“你为什么不去国王路的那家新商店看看”与A方的话逻辑关系一致,是正确答案。

  • 第9题:

    单选题
    There is something wrong with my TV set:I must have it _____.
    A

    checking

    B

    cheek

    C

    to check

    D

    checked


    正确答案: D
    解析:
    句意:我的电视机出了毛病,我必须检查一下。根据句意可知,“TV set”与“check”之间为被动关系,用“have sth. done”结构表被动,因此D选项正确。

  • 第10题:

    单选题
    Throw语句抛出的异常类型必须是()
    A

     System.Exception或从System.Exception派生的类型

    B

     System.Show类型

    C

     System类型

    D

     任意类型


    正确答案: C
    解析: 暂无解析

  • 第11题:

    单选题
    class Birds {  public static void main(String [] args) {  try {  throw new Exception();  } catch (Exception e) { try {  throw new Exception();  } catch (Exception e2) { System.out.print("inner "); }  System.out.print("middle "); }  System.out.print("outer ");  }  }  结果为:()
    A

    inner

    B

    inner outer

    C

    middle outer

    D

    inner middle outer


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于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!);


    正确答案: D
    解析: 暂无解析

  • 第13题:

    下面程序输出的结果是什么? ( ) public class Quiz2 { public static void main(String args[]) { try {throw new MyException(); }catch(Exception e) { System.out.println("It's caught!"); }finally{ System.out.println("It's finally caught!"); } } } class MyException extends Exception{}

    A.It's finally caught!

    B.It's caught!

    C.It's caught!/It's finally caught!

    D.无输出


    正确答案:C
    解析:本题是对异常处理基本知识的考查。本程序中创建了一个异常类MyException,它的祖先类是Exception。在程序中,程序先发出异常MyException,下面是catch捕获异常,但是catch列表中并没有与之对应的MyExcepfion,但是有一个Exception,它是MyException的祖先类。如果有多种异常需要捕获,在安排catch语句的顺序时要注意,应该首先捕获最特殊的类,然后逐渐一般化。例如,IOExcepfion类是FileNotFoundException类的父类;就应该首先捕获FileNotFoundException异常,然后捕获IOExcepfion异常。所以运行结果是It'scaught!/It'sfinallycaught!

  • 第14题:

    下面程序输出的结果是什么? ( ) public class Quiz2 { public static void main(String args[]) { try {throw new MyException(); }catch(Exception e) { System.out.println("It's caught!"); }finally{ System.out.println("It's finally caught!"); } } } class MyExeeption extends Exception{}

    A.It's finally caught!

    B.It's caught!

    C.It's caught!/It'sfinally caught!

    D.无输出


    正确答案:C
    解析:本题是对异常处理基本知识的考查。本程序中创建了一个异常类MyExce-ption,它的祖先类是Exception。在程序中,程序先发出异常MyException,下面是catch捕获异常,但是catch列表中并没有与之对应的MyException,但是有一个Exception,它是MyException的祖先类。如果有多种异常需要捕获,在安排catch语句的顺序时要注意,应该首先捕获最特殊的类,然后逐渐一般化。例如,IOException类是FileNotFoundException类的父类,就应该首先捕获FileNotFoundException异常,然后捕获IOException异常。所以运行结果是Ifscaught!/It'sfinallycaught!

  • 第15题:

    下面哪些类型的实例对象可以通过throw语句抛出()。

    • A、Event
    • B、Object
    • C、Throwable
    • D、RuntimeException
    • E、Exception

    正确答案:C,D,E

  • 第16题:

    程序读入用户输入的一个值,要求创建一个自定义的异常,如果输入值大于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!");

    正确答案:C

  • 第17题:

    Throw语句抛出的异常类型必须是()

    • A、 System.Exception或从System.Exception派生的类型
    • B、 System.Show类型
    • C、 System类型
    • D、 任意类型

    正确答案:A

  • 第18题:

    现有:  class Birds {  public static void main (String  []  args)  {   try {  throw new Exception () ;    } catch (Exception e) {   try {   throw new Exception () ;  }  catch  (Exception e2)  {  System.out.print ("inner           "); }   System. out.print ( "middle" ) ;    }  System.out.print ("outer") ;    }    }  结果是()

    • A、 inner outer
    • B、 middle outer
    • C、 inner middle outer
    • D、.编译失败

    正确答案:C

  • 第19题:

    单选题
    程序读入用户输入的一个值,要求创建一个异常,如果输入值大于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!”);


    正确答案: D
    解析: 暂无解析

  • 第20题:

    单选题
    现有:  class Birds {  public static void main (String  []  args)  {   try {  throw new Exception () ;    } catch (Exception e) {   try {   throw new Exception () ;  }  catch  (Exception e2)  {  System.out.print ("inner           "); }   System. out.print ( "middle" ) ;    }  System.out.print ("outer") ;    }    }  结果是()
    A

     inner outer

    B

     middle outer

    C

     inner middle outer

    D

    .编译失败


    正确答案: C
    解析: 暂无解析

  • 第21题:

    单选题
    —I must have eaten something wrong. I feel like______ .  —I told you not to eat at a restaurant. You’d better ______ at home.
    A

    to throw up...to eat

    B

    throwing up...eating

    C

    to throw up...eat

    D

    throwing up...eat


    正确答案: D
    解析:
    句意:——我一定是吃坏什么东西了,想吐。——我告诉过你不要在餐馆里吃饭了,你最好在家吃。feel like想要,后接名词或动名词。had better最好,后接动词原形。

  • 第22题:

    单选题
    假设有自定义异常类ServiceException,那么抛出该异常的语句正确的是哪项?()
    A

     raise ServiceException

    B

     throw new ServiceException()

    C

     throw ServiceException

    D

     throws ServiceException


    正确答案: A
    解析: 暂无解析

  • 第23题:

    单选题
    Which the statement is true?()
    A

     The Error class is a Runtime Exception.

    B

     No exceptions are subclasses of Error.

    C

     Any statement that may throw an Error must be enclosed in a try block.

    D

     any statement that may throw an Exception must be enclosed in a try block.

    E

     Any statement that may throw an Runtime Exception must be enclosed in a try block.


    正确答案: E
    解析: 暂无解析

  • 第24题:

    单选题
    —I must have eaten something wrong. I feel like ______.   —I told you not to eat at a restaurant. You’d better ______ at home.
    A

    to throw up ... to eat

    B

    throwing up ... eating

    C

    to throw up ... eat

    D

    throwing up ... eat


    正确答案: D
    解析: 句意:——我一定是吃坏什么东西了,想吐。——我告诉过你不要在餐馆里吃饭了,你最好在家吃。feel like想要,后接名词或动名词。had better最好,后接动词原形。