niusouti.com

现有:  class Number{  public static void main(String  []  aras)  {      try  {  System.out.print (Integer.parselnt ("forty"));      } catch (RuntimeException r)  {      System.out.print ("runtime");  } catch  (NumberFormatException e)  {      system..ut.pr

题目

现有:  class Number{  public static void main(String  []  aras)  {      try  {  System.out.print (Integer.parselnt ("forty"));      } catch (RuntimeException r)  {      System.out.print ("runtime");  } catch  (NumberFormatException e)  {      system..ut.print("number");      }      }      }  结果是什么?()     

  • A、number
  • B、runtime
  • C、forty number
  • D、编译失败

相似考题
参考答案和解析
正确答案:D
更多“现有:  class Number{  public static void main(String  []  aras)  {      try  {  System.out.print (Integer.parselnt ("forty"));      } catch (RuntimeException r)  {      System.out.print ("runtime");  } catch  (NumberFormatException e)  {      system..ut.pri”相关问题
  • 第1题:

    现有  class Parser extends Utils {  public static void main (String  []  args)  {  try  {  System.out.print (new Parser () .getlnt ("42"))       }  catch (Exception e) {  System.out.println ("Exc") ;  }      }  int getlnt (String arg)  throws Exception  {     return Integer.parselnt (arg) ;      }      }  class Utils {  int getlnt ()  {  return 42;  }     }  结果是什么?()      

    • A、 42Exc
    • B、 Exc
    • C、 42
    • D、编译失败

    正确答案:C

  • 第2题:

    static void test() {  try {  String x=null;  System.out.print(x.toString() +“ “);  }  finally { System.out.print(“finally “); }  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  }  What is the result?() 

    • A、 null
    • B、 finally
    • C、 null finally
    • D、 Compilation fails.
    • E、 finally exception

    正确答案:E

  • 第3题:

    class Parser extends Utils {  public static void main (String [] args) {  try { System.out.print(new Parser().getInt("42"));  } catch (NumberFormatException n) {  System.out.println("NFExc "); }  }  int getInt(String arg) throws NumberFormatException {  return Integer.parseInt(arg);  }  }  class Utils {  int getInt(String arg) { return 42; }  }  结果为:() 

    • A、42
    • B、NFExc
    • C、42NFExc
    • D、编译失败

    正确答案:A

  • 第4题:

    现有:  class  Parser extends  Utilis  {  public static void main (String  []  args)  {  try  {  System. out.print (new  Parser ( ) .getlnt ("42")} ;     }  catch (NumberFormatException n) {  System.out .println ( "NFExc" ) ;   }     }  int getlnt (String arg)  throws NumberFormatException{    return Integer.parselnt (arg) ;     }     class Utils {  int getlnt (String arg)  {  return 42;  }    }  结果为 :()

    • A、 NFExc
    • B、 42
    • C、 42NFExc
    • D、编译失败

    正确答案:B

  • 第5题:

    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result? () 

    • A、 AB
    • B、 BC
    • C、 ABC
    • D、 BCD
    • E、 Compilation fails.

    正确答案:D

  • 第6题:

    public class TestApp{  public static void main(String[] args){       try{  int i = 0;           int j = 1 / i;           String myname=null;            if(myname.length()>2)              System.out.print(“1”);        }catch(NullPointerException e){  System.out.print(“2”);       }  catch(Exception e){  System.out.print(“3”);       }   } }  上述程序运行后的输出是哪项?()

    • A、 3
    • B、 2
    • C、 231
    • D、 32

    正确答案:A

  • 第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题:

    单选题
    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (RuntimeException ex) {  System.out.print(“B”);  }  catch (Exception ex1) {  System.out.print(“C”);  }   finally {  System.out.print(“D”);  }  System.out.print(“E”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result?()
    A

     BD

    B

     BCD

    C

     BDE

    D

     BCDE

    E

     ABCDE

    F

     Compilation fails.


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

  • 第9题:

    单选题
    现有:  class Parser extends Utils  { public static void main (String[]  args)    {     try{System.out.print (new Parser().getlnt("42"));      } catch (Exception e)    {      System.out.println("Exc");  }      }  int getlnt (String arg) throws Exception  {      return Integer.parselnt (arg);      }       class Utils  {  int getlnt (String arg)    {return 42;  }      }      结果为()
    A

     42

    B

     Exc

    C

     42Exc

    D

    编译失败


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

  • 第10题:

    单选题
    static void test() throws RuntimeException {  try {  System.out.print(”test “);  throw new RuntimeException();  }  catch (Exception ex) { System.out.print(”exception “); }  }  public static void main(String[] args) {  try { test(); }  catch (RuntimeException ex) { System.out.print(”runtime “); }  System.out.print(”end “);  }  What is the result?()
    A

     test end

    B

     Compilation fails.

    C

     test runtime end

    D

     test exception end

    E

     A Throwable is thrown by main at runtime.


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

  • 第11题:

    单选题
    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result? ()
    A

     AB

    B

     BC

    C

     ABC

    D

     BCD

    E

     Compilation fails.


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

  • 第12题:

    单选题
    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”); }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }   public static void badMethod() {} }  What is the result?()
    A

     AC

    B

     BD

    C

     ACD

    D

     ABCD

    E

     Compilation fails.


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

  • 第13题:

    class Number {  public static void main(String [] args) {  try {  System.out.print(Integer.parseInt("forty ")); } catch (RuntimeException r) {  System.out.print("runtime ");  } catch (NumberFormatException e) {  System.out.print("number ");  }  }  }  结果是什么?() 

    • A、forty
    • B、number
    • C、runtime
    • D、编译失败

    正确答案:D

  • 第14题:

    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”); }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }   public static void badMethod() {} }  What is the result?()  

    • A、 AC
    • B、 BD
    • C、 ACD
    • D、 ABCD
    • E、 Compilation fails.

    正确答案:C

  • 第15题:

    现有:  class Flow {  public static void main(String [] args)   try {  System. out .print ("before") ;   doRiskyThing ( )  ;   System.out.print ("after ") ;   } catch (Exception fe) {  System.out.print ("catch") ;   }  System. out .println ( " done") ;  }  public static void doRiskyThing() throws Exception{   // this code returns unless it throws an Exception           }}  可能会产生哪两项结果 ?()  

    • A、 before catch
    • B、 before after done
    • C、 before catch done
    • D、 before after catch

    正确答案:B,C

  • 第16题:

    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (RuntimeException ex) {  System.out.print(“B”);  }  catch (Exception ex1) {  System.out.print(“C”);  }   finally {  System.out.print(“D”);  }  System.out.print(“E”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result?()  

    • A、 BD
    • B、 BCD
    • C、 BDE
    • D、 BCDE
    • E、 ABCDE
    • F、 Compilation fails.

    正确答案:C

  • 第17题:

    class Flow {  public static void main(String [] args) {  try {  System.out.print("before ");  doRiskyThing();  System.out.print("after ");  } catch (Exception fe) {  System.out.print("catch ");  }  System.out.println("done ");  }   public static void doRiskyThing() throws Exception {  // this code returns unless it throws an Exception  } }  可能会产生下面哪两项结果?() 

    • A、before
    • B、before catch
    • C、before after done
    • D、before catch done

    正确答案:C,D

  • 第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题:

    class Order implements Runnable {    public void run ()  {  try { Thread.sleep (2000) ;  } catch (Exception e)    System.out.print("in") ;  public static void main (String [] args)  {    Thread t = new Thread (new Order ()) ;    t.start () ;  System.out.print ("pre ") ;  try { t.join () ;  } catch (Exception e)  { }    System.out.print ("post") ;   可产生哪两项结果?()  

    • A、 pre in post
    • B、 pre in
    • C、 in post pre
    • D、 in pre post
    • E、 pre post in

    正确答案:A,D

  • 第20题:

    单选题
    static void test() {  try {  String x=null;  System.out.print(x.toString() +“ “);  }  finally { System.out.print(“finally “); }  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  }  What is the result?()
    A

     null

    B

     finally

    C

     null finally

    D

     Compilation fails.

    E

     finally exception


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

  • 第21题:

    单选题
    现有:  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
    解析: 暂无解析

  • 第22题:

    单选题
    现有:  class Number{  public static void main(String  []  aras)  {      try  {  System.out.print (Integer.parselnt ("forty"));      } catch (RuntimeException r)  {      System.out.print ("runtime");  } catch  (NumberFormatException e)  {      system..ut.print("number");      }      }      }  结果是什么?()
    A

    number

    B

    runtime

    C

    forty number

    D

    编译失败


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

  • 第23题:

    多选题
    class Order implements Runnable {  public void run() {  try { Thread.sleep(2000); } catch (Exception e) { }  System.out.print("in ");  }  public static void main(String [] args) {  Thread t = new Thread(new Order());  t.start();  System.out.print("pre ");  try { t.join(); } catch (Exception e) { }  System.out.print("post ");  } }  可产生哪两项结果?()
    A

    in pre

    B

    pre in

    C

    in pre post

    D

    pre in post


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