12. void start() {  13. A a = new A();  14. B b = new B();  15. a.s(b);  16. b = null;  17. a = null;  18. System.out.println(“start completed”); 19. }  When is the B object, created in line 14, eligible for garbage collection?()  A、 After line 16.B、 After line 17.C、 After line 18 (when the methods ends).D、 There is no way to be absolutely certain.E、 The object is NOT eligible for garbage collection.

12. void start() {  13. A a = new A();  14. B b = new B();  15. a.s(b);  16. b = null;  17. a = null;  18. System.out.println(“start completed”); 19. }  When is the B object, created in line 14, eligible for garbage collection?()  

  • A、 After line 16.
  • B、 After line 17.
  • C、 After line 18 (when the methods ends).
  • D、 There is no way to be absolutely certain.
  • E、 The object is NOT eligible for garbage collection.

相关考题:

( 24 )请阅读下面程序public class ThreadTest {public static void main ( String args[ ]){Thread t1 = new Thread ( new Hello ()):Thread t2 = new Thread ( new Hello ()):t l .start ():t2.start ();}}class Hello implements Runnable {int i ;public void run (){while ( true ) {System.out.println ( "Hello"+i++ ) ;if ( i=5 ) break :}}}该程序创建线程使用的方法是()A )继承 Thread 类B )实现 Runnable 接口C ) t l.start ()D ) t2.start ()

下列代码中的内部类名是______。import java.awt.event.*;import javax.swing.*;class Talkingclock{public void start (int interval, final boolean beep){ActionListener listener=newActionListener(){public void actionPerformed (ActionEvent event) {......}}Timer t=new Timer(interval, listener);t. start();]}A) TimerB) ActionListenerC) listenerD) 匿名A.B.C.D.

ClicktheExhibitbutton.Assumingthetaglibraryintheexhibitisimportedwiththeprefixstock,whichcustomtaginvocationoutputsthecontentsofthevariableexposedbythequotetag?() A.;stock:quoteensp;symbol=;SUNW;ensp;/;${var}B.${var}.ensp;;stock:quoteensp;symbol=;SUNW;ensp;/;C.;stock:quoteensp;symbol=;SUNW;;.ensp;${var}.ensp;;/stock:quote;D.;stock:quoteensp;symbol=;SUNW;ensp;var=;quote;ensp;/;${quote}

WhichmethodintheThreadclassisusedtocreateandlaunchanewthreadofexecution?() A.ensp;Run();B.ensp;Start();C.ensp;Execute();D.ensp;Run(Runnableensp;r);E.ensp;Start(Runnableensp;r);F.ensp;Execute(Threadensp;t);

1. class Test {  2. private Demo d;  3. void start() {  4. d = new Demo();  5. this.takeDemo(d); 6. }  7.   8. void takeDemo(Demo demo) {  9. demo = null;  10. demo = new Demo(); 11. }  12. }  When is the Demo object, created on line 3, eligible for garbage collection?()  A、 After line 5.B、 After line 9.C、 After the start() method completes.D、 When the takeDemo() method completes.E、 When the instance running this code is made eligible for garbage collection.

class TestA {  public void start() { System.out.println(”TestA”); }  }  public class TestB extends TestA {  public void start() { System.out.println(”TestB”); } public static void main(String[] args) {  ((TestA)new TestB()).start();  }  }  What is the result?() A、 TestAB、 TestBC、 Compilation fails.D、 An exception is thrown at runtime.

Properties类中的哪个方法可以和IO流相关联()。A、ensp;getProperty()B、ensp;setProperty()C、ensp;load()D、ensp;stringPropertyNames()

作为类中新线程的开始点,线程的执行是从()方法开始的。A、public void start()B、public void run()C、public void int()D、public static void main(Stringargs[])

下面那一个函数是线程的入口函数? ()A、private void run()B、public void run()C、public void start()D、public void begin()

Which method must be defined by a class implementing the java.lang.Runnable interface? () A、 void run()B、 public void run()C、 public void start()D、 void run(int priority)E、 public void run(int priority)F、 public void start(int priority)

Which method in the Thread class is used to create and launch a new thread of execution?()A、ensp;Run();B、ensp;Start();C、ensp;Execute();D、ensp;Run(Runnableensp;r);E、ensp;Start(Runnableensp;r);F、ensp;Execute(Threadensp;t);

class Work implements Runnable {  Thread other;   Work(Thread other) { this.other = other; }  public void run() {  try { other.join(); } catch (Exception e) { }  System.out.print("after join ");  } }  class Launch {  public static void main(String [] args) {  new Thread(new Work(Thread.currentThread())).start();  System.out.print("after start ");  } }  结果为:()A、after joinB、after startC、after join after startD、after start after join

public class Threads4 {  public static void main (String[] args) {  new Threads4().go();  }  public void go() {  Runnable r = new Runnable() { public void run() {  System.out.print(”foo”);  }  };  Thread t = new Thread(r);  t.start();  t.start();  }  }  What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 The code executes normally and prints „foo”.D、 The code executes normally, but nothing is printed.

Which two code fragments will execute the method doStuff() in a separate thread?()A、new Thread() {public void run() { doStuff(); }};B、new Thread() {public void start() { doStuff(); }};C、new Thread() {public void start() { doStuff(); }}.run();D、new Thread() {public void run() { doStuff(); }}.start();E、new Thread(new Runnable() {public void run() { doStuff(); }}).start();

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

单选题Which method must be defined by a class implementing the java.lang.Runnable interface? ()A void run()B public void run()C public void start()D void run(int priority)E public void run(int priority)F public void start(int priority)

单选题Given that a static method doIt() in a class Work represents work to be done, what block of code will succeed in starting a new thread that will do the work?   CODE BLOCK a:   Runnable r = new Runnable() {   public void run() {   Work.doIt();   }   };   Thread t = new Thread(r);   t.start();   CODE BLOCK b:   Thread t = new Thread() {  public void start() {   Work.doIt();  }  };   t.start();   CODE BLOCK c:   Runnable r = new Runnable() {   public void run() {   Work.doIt();   }   };   r.start();  CODE BLOCK d:   Thread t = new Thread(new Work());   t.start();   CODE BLOCK e:   Runnable t = new Runnable() {   public void run() {   Work.doIt();   }   };   t.run();ACode block a.BCode block B.CCode block c.DCode block d.ECode block e.

单选题1. class Test {  2. private Demo d;  3. void start() {  4. d = new Demo();  5. this.takeDemo(d); 6. }  7.   8. void takeDemo(Demo demo) {  9. demo = null;  10. demo = new Demo(); 11. }  12. }  When is the Demo object, created on line 3, eligible for garbage collection?()A After line 5.B After line 9.C After the start() method completes.D When the takeDemo() method completes.E When the instance running this code is made eligible for garbage collection.

多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() {public void run() { doStuff(); }};Bnew Thread() {public void start() { doStuff(); }};Cnew Thread() {public void start() { doStuff(); }}.run();Dnew Thread() {public void run() { doStuff(); }}.start();Enew Thread(new Runnable() {public void run() { doStuff(); }}).start();

单选题public class Threads4 {  public static void main (String[] args) {  new Threads4().go();  }  public void go() {  Runnable r = new Runnable() { public void run() {  System.out.print(”foo”);  }  };  Thread t = new Thread(r);  t.start();  t.start();  }  }  What is the result?()A Compilation fails.B An exception is thrown at runtime.C The code executes normally and prints „foo”.D The code executes normally, but nothing is printed.

单选题现有:      class TestA  {  public void start()  {  System.out.println("TestA");  }     }  public class TestB extends TestA  {  public void start()  {  System.out.println("TestB");  }     public static void main (string[]  args)  (     ((TestA)new TestB()).start();     )     }  运行结果是哪项?()A  TeStAB  TeStBC编译失败D运行时抛出异常

单选题class TestA {  public void start() { System.out.println(”TestA”); }  }  public class TestB extends TestA {  public void start() { System.out.println(”TestB”); } public static void main(String[] args) {  ((TestA)new TestB()).start();  }  }  What is the result?()A TestAB TestBC Compilation fails.D An exception is thrown at runtime.

单选题12. void start() {  13. A a = new A();  14. B b = new B();  15. a.s(b);  16. b = null;  17. a = null;  18. System.out.println(“start completed”); 19. }  When is the B object, created in line 14, eligible for garbage collection?()A After line 16.B After line 17.C After line 18 (when the methods ends).D There is no way to be absolutely certain.E The object is NOT eligible for garbage collection.

单选题下列代码中的内部类名是(  )。import java.awt.event.*;import javax.swing.*;class TalkingClock{public void start(int interval,final boolean beep){ActionListener listener=new ActionListener(){public void actionPerformed(ActionEvent event){……}}Timer t=new Timer(interval,listener);t.start();}}ATimerBActionListenerClistenerD匿名

多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() { public void run() { doStuff(); } }Bnew Thread() { public void start() { doStuff(); } }Cnew Thread() { public void start() { doStuff(); } } .run();Dnew Thread() { public void run() { doStuff(); } } .start();Enew Thread(new Runnable() { public void run() { doStuff(); } } ).run();Fnew Thread(new Runnable() { public void run() { doStuff(); } }).start();

单选题下面那一个函数是线程的入口函数? ()Aprivate void run()Bpublic void run()Cpublic void start()Dpublic void begin()

单选题Click the Exhibit button. Assuming the tag library in the exhibit is imported with the prefix stock,which custom tag invocation outputsthe contents of the variable exposed by the quote tag?()A ;stock:quoteensp;symbol=";SUNW";ensp;/;${var}B ${var}.ensp;;stock:quoteensp;symbol=";SUNW";ensp;/;C ;stock:quoteensp;symbol=";SUNW";;.ensp;${var}.ensp;;/stock:quote;D ;stock:quoteensp;symbol=";SUNW";ensp;var=";quote";ensp;/;${quote}