Java OCA OCP Practice Question 1261

Question

Which of the following statements about threads is true?

  • A. Every thread starts executing with a priority of 5.
  • B. Threads inherit their priority from their parent thread.
  • C. Threads are guaranteed to run with the priority that you set using the setPriority() method.
  • D. Thread priority is an integer ranging from 1 to 100.


B.

Note

Threads inherit their priority from their parent thread.

A is incorrect because, although the default priority for a thread is 5, it may be changed by the parent thread.

C is incorrect because Java does not make any promises about priority at runtime.

D is incorrect because thread priorities range from 1 to 10.




PreviousNext

Related