Which three are true?

Given the code fragment:

1. Thread t1 = new Thread ();

2. t1.start ()

3. t1.join ( );

4. // . . .

Which three are true?

Given the code fragment:

1. Thread t1 = new Thread ();

2. t1.start ()

3. t1.join ( );

4. // . . .

Which three are true?

A.
On line 3, the current thread stops and waits until the t1 thread finishes.

B.
On line 3, the t1 thread stops and waits until the current thread finishes.

C.
On line 4, the t1 thread is dead.

D.
On line 4, the t1 thread is waiting to run.

E.
This code cannot throw a checked exception.

F.
This code may throw a checked exception.

Explanation:
A, C: Thejoin()methods waits for this thread to die.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Charlie

Charlie

join() may throw InterruptedException which is a checked exception.