Java Programming - Threads - Discussion

Discussion Forum : Threads - General Questions (Q.No. 2)
2.
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)
1 and 3
2 and 4
1 and 2
2 and 5
Answer: Option
Explanation:

(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.

Discussion:
11 comments Page 2 of 2.

Kartiki said:   7 years ago
What is the main use of thread class?
(1)


Post your comments here:

Your comments will be displayed after verification.