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.

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.

相关考题:

Given: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 */ }

Given: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.

Given:Which method will complete this class?() A.public int compareTo(Object o){/*more code here*/}B.public int compareTo(Score other){/*more code here*/}C.public int compare(Score s1,Score s2){/*more code here*/}D.public int compare(Object o1,Object o2){/*more code here*/}

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

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?()A、 The application will crash.B、 The code on line 29 will be executed.C、 The code on line 5 of class A will execute.D、 The code on line 5 of class B will execute.E、 The exception will be propagated back to line 27.

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());

public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return ““ + wins + “,“ + losses + “”; }  // insert code here  }  Which method will complete this class?() A、 public int compareTo(Object o) {/*mode code here*/}B、 public int compareTo(Score other) {/*more code here*/}C、 public int compare(Score s1,Score s2){/*more code here*/}D、 public int compare(Object o1,Object o2){/*more code here*/}

public class Team extends java.util.LinkedList {  public void addPlayer(Player p) {  add(p);  }  public void compete(Team opponent) { /* more code here */ }  }  class Player { /* more code here */ }  Which two are true?()A、 This code will compile.B、 This code demonstrates proper design of an is-a relationship.C、 This code demonstrates proper design of a has-a relationship.D、 A Java programmer using the Team class could remove Player objects from a Team object.

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);

11. public interface Status {  12. /* insert code here */ int MY_VALUE = 10;  13. }  Which three are valid on line 12?()A、 finalB、 staticC、 nativeD、 publicE、 privateF、 abstractG、 protected

Which three will compile and run without exception?()A、private synchronized Object o;B、void go(){   synchronized(){/* code here */}C、public synchronized void go(){/* code here */}D、private synchronized(this) void go(){/* code here */}E、void go(){   synchronized(Object.class){/* code here */}F、void go(){   Object o = new Object();   synchronized(o){/* code here */}

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

Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()A、finalB、staticC、nativeD、publicE、private

多选题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 */ }

多选题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 */ }

多选题public class Team extends java.util.LinkedList {  public void addPlayer(Player p) {  add(p);  }  public void compete(Team opponent) { /* more code here */ }  }  class Player { /* more code here */ }  Which two are true?()AThis code will compile.BThis code demonstrates proper design of an is-a relationship.CThis code demonstrates proper design of a has-a relationship.DA Java programmer using the Team class could remove Player objects from a Team object.

单选题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.

单选题ABCDEFGHIJKLMNOPQRSTUVWXYZ  The alphabet is here to help you with these questions.  You need to work out a different code for each question.Example  If the code for FOOT is ENNS, what is the code for TOE?Answer SND  If the code for ORANGE is RUDQJH, what does SLQN mean?AOHMJBPINKCQJOLDPOKE

多选题Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivate

多选题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.

多选题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 */ }

多选题11. public interface Status {  12. /* insert code here */ int MY_VALUE = 10;  13. }  Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivateFabstractGprotected

单选题11.rbo = new ReallyBigObject(); 12.//more code here 13.rbo = null; 14./*insert code here*/ Which statement should be placed at line 14 to suggest that the virtual machine expend effort toward recycling the memory used by the objectrbo?()ASystem.gc();BRuntime.gc();CSystem.freeMemory();DRuntime.getRuntime().growHeap();ERuntime.getRuntime().freeMemory();

单选题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);

单选题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