Java OCA OCP Practice Question 1282

Question

Which of the following are true?

Choose all that apply.

  • A. When an application begins running, there is one daemon thread, whose job is to execute main().
  • B. When an application begins running, there is one non-daemon thread, whose job is to execute main().
  • C. A thread created by a daemon thread is initially also a daemon thread.
  • D. A thread created by a non-daemon thread is initially also a non-daemon thread.


B, C, D.

Note

A is wrong because main() is executed by a non-daemon thread.

B is correct because daemon threads are for the JVM's infrastructure.

Non-daemon threads are for programmers.

The JVM initially creates a non-daemon thread to run main().

C and D are both correct because a thread's daemon state is the same as that of its creating thread.




PreviousNext

Related