单选题33. try {  34. // some code here  35. } catch (NullPointerException e1) {  36. System.out.print(”a”);  37. } catch (RuntimeException e2) {  38. System.out.print(”b”);  39. } finally {  40. System.out.print(”c”);  41. }  What is the result if a NullPointerException occurs on line 34?()A cB aC abD acE bcF abc

单选题
33. try {  34. // some code here  35. } catch (NullPointerException e1) {  36. System.out.print(”a”);  37. } catch (RuntimeException e2) {  38. System.out.print(”b”);  39. } finally {  40. System.out.print(”c”);  41. }  What is the result if a NullPointerException occurs on line 34?()
A

 c

B

 a

C

 ab

D

 ac

E

 bc

F

 abc


参考解析

解析: 暂无解析

相关考题:

33.try{34.//somecodehere35.}catch(NullPointerExceptione1){36.System.out.print(”a”);37.}catch(RuntimeExceptione2){38.System.out.print(”b”);39.}finally{40.System.out.print(”c”);41.}WhatistheresultifaNullPointerExceptionoccursonline34?()A.cB.aC.abD.acE.bcF.abc

//somecodehere32.try{33.//somecodehere34.}catch(SomeExceptionse){35.//somecodehere36.}finally{37.//somecodehere38.}Underwhichthreecircumstanceswillthecodeonline37beexecuted?() A.Theinstancegetsgarbagecollected.B.Thecodeonline33throwsanexception.C.Thecodeonline35throwsanexception.D.Thecodeonline31throwsanexception.E.Thecodeonline33executessuccessfully.

以下对于try…catch语句描述正确的是() A.try…catch语句处理程序中的错误B.try...catch语句处理程序中的bugC.try...catch语句处理程序中的异常D.以上说法都不正确

1. public class a {  2. public void method1() {  3. try {  4. B b=new b();  5. b.method2();  6. // more code here  7. } catch (TestException te) {  8. throw new RuntimeException(te);  9. }  10. }  11. }  1. public class b {  2. public void method2() throws TestException {  3. // more code here  4. }  5. }  1. public class TestException extends Exception {  2. }  Given:  31. public void method() {  32. A a=new a();  33. a.method1();  34. }  Which is true if a TestException is thrown on line 3 of class b?()A、 Line 33 must be called within a try block.B、 The exception thrown by method1 in class a is not required to be caught.C、 The method declared on line 31 must be declared to throw a RuntimeException.D、 On line 5 of class a, the call to method2 of class b does not need to be placed in a try/catch block.

class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 int foo() { /* more code here */ }B、 void foo() { /* more code here */ }C、 public void foo() { /* more code here */ }D、 private void foo() { /* more code here */ }E、 protected void foo() { /* more code here */ }

33. try {  34. // some code here  35. } catch (NullPointerException e1) {  36. System.out.print(”a”);  37. } catch (RuntimeException e2) {  38. System.out.print(”b”);  39. } finally {  40. System.out.print(”c”);  41. }  What is the result if a NullPointerException occurs on line 34?() A、 cB、 aC、 abD、 acE、 bcF、 abc

public class foo {   public static void main (stringargs)   try {return;}   finally {system.out.printIn(“Finally”);}   }     What is the result?()  A、 The program runs and prints nothing.B、 The program runs and prints “Finally”C、 The code compiles, but an exception is thrown at runtime.D、 The code will not compile because the catch block is missing.

31. // some code here  32. try {  33. // some code here  34. } catch (SomeException se) {  35. // some code here  36. } finally {  37. // some code here  38. }  Under which three circumstances will the code on line 37 be executed?()A、 The instance gets garbage collected.B、 The code on line 33 throws an exception.C、 The code on line 35 throws an exception.D、 The code on line 31 throws an exception.E、 The code on line 33 executes successfully.

在C#语言中,下列异常处理结构中有错误的是()。A、catch{}finally{}B、try{}finally{}C、try{}catch{}finally{}D、try{}catch{}

在C#程序中〃下列用来处理异常的结构〃错误的是()。A、catch{}finally{}B、try{}finally{}C、try{}catch{}finally{}D、try{}catch{}

下面关于try、catch和finally语句块的组合使用,正确的是()A、try{,}B、try{,}finally{,}C、try{,}catch{,}finally{,}D、try{,}catch{,}catch{,}

1. class Calc {  2. public static void main(String [] args) {  3. try {  4. int x = Integer.parseInt("42a");  5. //insert code here  6. System.out.print("oops ");  7. }  8. }  9. }  下面哪两行分别插入到第五行,会导致输出“oops”?()A、} catch (ClassCastException c) {B、} catch (IllegalStateException c) {C、} catch (NumberFormatException n) {D、} catch (IllegalArgumentException e) {

34. HashMap props = new HashMap();  35. props.put(”key45”, “some value”);  36. props.put(”key12”, “some other value”);  37. props.put(”key39”, “yet another value”);  38. Set s = props.keySet();  39. // insert code here  What, inserted at line 39, will sort the keys in the props HashMap?() A、 Arrays.sort(s);B、 s = new TreeSet(s);C、 Collections.sort(s);D、 s = new SortedSet(s);

多选题class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }

多选题31. // some code here  32. try {  33. // some code here  34. } catch (SomeException se) {  35. // some code here  36. } finally {  37. // some code here  38. }  Under which three circumstances will the code on line 37 be executed?()AThe instance gets garbage collected.BThe code on line 33 throws an exception.CThe code on line 35 throws an exception.DThe code on line 31 throws an exception.EThe code on line 33 executes successfully.

单选题Given a valid DateFormat object named df,and 16.Date d = new Date(0L); 17.String ds = "December 15, 2004"; 18.//insert code here What updates d’s value with the date represented by ds?()A18. d = df.parse(ds);B18. d = df.getDate(ds);C18. try {19. d = df.parse(ds);20. } catch(ParseException e) { };D18. try {19. d = df.getDate(ds);20. } catch(ParseException e) { };

多选题Given: Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }

单选题33. Date d = new Date(0);  34. String ds = “December 15, 2004”;  35. // insert code here  36. try {  37. d = df.parse(ds);  38. }  39. catch(ParseException e) {  40. System.out.println(”Unable to parse “+ ds);  41. }  42. // insert code here too  Which will create the appropriate DateFormat object and add a day to the Date object?()A 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setTime( (60 * 60 * 24) +d.getTime());B 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setTime( (1000 * 60 * 60 * 24) + d.getTime());C 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setLocalTime( (1000*60*60*24) + d.getLocalTime());D 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setLocalTime( (60 * 60 * 24) + d.getLocalTime());

单选题What is wrong with the following code?()   class MyException extends Exception {}   public class Qb4ab {   public void foo() {  try {  bar();  } finally {  baz();   } catch (MyException e) {}  }   public void bar() throws MyException {   throw new MyException();  }   public void baz() throws RuntimeException {   throw new RuntimeException();   }   }ASince the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause.BA try block cannot be followed by both a catch and a finally block.CAn empty catch block is not allowed.DA catch block cannot follow a finally block.EA finally block must always follow one or more catch blocks.

单选题Given: 5.public class MyTagHandler extends TagSupport { 6.public int doStartTag() throws JspException { 7.try { 8.// insert code here 9.} catch(Exception ex) { /* handle exception */ } 10.return super.doStartTag(); 11.}...42. } Which code snippet, inserted at line 8,causes the value foo to be output?()AJspWriter w = pageContext.getOut();Bprint(foo);CJspWriter w = pageContext.getWriter();DJspWriter w = new JspWriter(pageContext.getWriter()); . w.print(foo);

多选题1. class Calc {  2. public static void main(String [] args) {  3. try {  4. int x = Integer.parseInt("42a");  5. //insert code here  6. System.out.print("oops ");  7. }  8. }  9. }  下面哪两行分别插入到第五行,会导致输出“oops”?()A} catch (ClassCastException c) {B} catch (IllegalStateException c) {C} catch (NumberFormatException n) {D} catch (IllegalArgumentException e) {

单选题1. public class a {  2. public void method1() {  3. try {  4. B b=new b();  5. b.method2();  6. // more code here  7. } catch (TestException te) {  8. throw new RuntimeException(te);  9. }  10. }  11. }  1. public class b {  2. public void method2() throws TestException {  3. // more code here  4. }  5. }  1. public class TestException extends Exception {  2. }  Given:  31. public void method() {  32. A a=new a();  33. a.method1();  34. }  Which is true if a TestException is thrown on line 3 of class b?()A Line 33 must be called within a try block.B The exception thrown by method1 in class a is not required to be caught.C The method declared on line 31 must be declared to throw a RuntimeException.D On line 5 of class a, the call to method2 of class b does not need to be placed in a try/catch block.

单选题现有:  5.  class Order2 implements Runnable  {     6.    public void run()  {     7. for (int x- o;  x4;  x++)  {  8. try{Thread.sleep(100);  )catch  (Exception e)  {  }     9.    System.out.print("r");     10.    }  }  11.    public static void main(string  []  args)  {     12.    Thread t=new Thread(new order2());     13.    t.start();  14.    for(int x=0;  x4;  x++)  {     15.    //insert code here     16.    System.out.print("m");     17.  }  }  }  哪一个插入到第15行,最有可能产生输出 rmrmrmrm?()A  Thread.sleep(1);B  Thread.sleep(100);C  Thread.sleep(1000);D  try{  Thread.sleep(1);  )  catch  (Exception e)  {  }E  try{Thread.sleep(100);  )  catch  (Exception  e)  {  }F  try{Thread.sleep(1000);  ) catch  (Exception  e)  { }

多选题Which three will compile and run without exception?()Aprivate synchronized Object o;Bvoid go(){   synchronized(){/* code here */}Cpublic synchronized void go(){/* code here */}Dprivate synchronized(this) void go(){/* code here */}Evoid go(){   synchronized(Object.class){/* code here */}Fvoid go(){   Object o = new Object();   synchronized(o){/* code here */}

多选题1. public class A {  2. public void method1() {  3. B b=new B();  4. b.method2();  5. // more code here  6. }  7. }  1. public class B {  2. public void method2() {  3.C c=new C();  4. c.method3();  5. // more code here  6. }  7. }  1. public class C {  2. public void method3() {  3. // more code here  4. }  5. }  Given:  25. try {  26. A a=new A();  27. a.method1();  28. } catch (Exception e) {  29. System.out.print(”an error occurred”);  30. }  Which two are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe code on line 5 of class B will execute.EThe exception will be propagated back to line 27.

单选题16. Date d = new Date(0L);  17. String ds = “December 15, 2004”;  18. // insert code here  What updates d‟s value with the date represented by ds?()A 18. d = df.parse(ds);B 18. d = df.getDate(ds);C 18. try { 19. d = df.parse(ds);  20. } catch(ParseException e) { };D 18. try {  19. d = df.getDate(ds);  20. } catch(ParseException e) { };

单选题33. try {  34. // some code here  35. } catch (NullPointerException e1) {  36. System.out.print(”a”);  37. } catch (RuntimeException e2) {  38. System.out.print(”b”);  39. } finally {  40. System.out.print(”c”);  41. }  What is the result if a NullPointerException occurs on line 34?()A cB aC abD acE bcF abc

单选题34. HashMap props = new HashMap();  35. props.put(”key45”, “some value”);  36. props.put(”key12”, “some other value”);  37. props.put(”key39”, “yet another value”);  38. Set s = props.keySet();  39. // insert code here  What, inserted at line 39, will sort the keys in the props HashMap?()A Arrays.sort(s);B s = new TreeSet(s);C Collections.sort(s);D s = new SortedSet(s);