What is the output if the main() method is run?

Refer to the Exhibit. What is the output if the main() method is run?

Refer to the Exhibit. What is the output if the main() method is run?

A.
4

B.
5

C.
8

D.
9

E.
Compilation fails.

F.
An exception is thrown at runtime.

G.
It is impossible to determine for certain.



Leave a Reply 1

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


Matti

Matti

D is correct!
line 20 :join() = this.join() means the main thread wait for the thread of object Starter run to end, so that the x = x * 2 is executed before line 21for sure.