Which two are true?

Given:

Which two are true?

Given:

Which two are true?

A.
A runtime exception is thrown on line 9.

B.
No output is produced.

C.
Greeting is printed once.

D.
Greeting is printed twice.

E.
No new threads of execution are started within the main method.

F.
One new thread of execution is started within the main method.

G.
Two new threads of execution are started within the main method.

Explanation:

Thread t2 is executed. Execution of T2 starts executionen of t1. Greeting is printed during
theexecution of t1.



Leave a Reply 5

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


BKhateib

BKhateib

Missing info

l0c

l0c

No info is missing here; We can clearly see the start-method of t2 is not called. We can also clearly see that t1 isn’t being used as a Thread, it’s used to pass a Runnable (Thread is-a Runnable) to t2.

I think the code will be different on the exam.. It doesn’t make much sense as is. It actually doesn’t compile. But there’s no “Compile error” answer on this one, so it must be different on the exam.

gelete

gelete

CE

Eclipse output:
Greeting