Threads

Q1:
Which two are valid constructors for Thread?
  1. Thread(Runnable r, String name)
  2. Thread()
  3. Thread(int priority)
  4. Thread(Runnable r, ThreadGroup g)
  5. Thread(Runnable r, int priority)

A 1 and 3

B 2 and 4

C 1 and 2

D 2 and 5

ANS:C - 1 and 2

(1) and (2) are both valid constructors for Thread. (3), (4), and (5) are not legal Thread constructors, although (4) is close. If you reverse the arguments in (4), you'd have a valid constructor.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.