Which of the following constructor of class Thread is valid one?
Which of the following constructor of class Thread is valid one? Correct Answer Thread(Runnable threadOb, String threadName)
A. Thread(Runnable threadOb, int priority)This constructor is invalid because the
Thread class does not have a constructor that takes a Runnable object and an int priority as arguments.B. Thread(int priority)
This constructor is invalid because the
Thread class does not have a constructor that takes only an int priority as an argument.C. Thread(Runnable threadOb, String threadName)
This constructor is valid. It creates a new thread with the provided
Runnable object and assigns it the specified name.D. Thread(String threadName, int priority)
This constructor is invalid because the
Thread class does not have a constructor that takes both a String thread name and an int priority as arguments.E. None of these
This option is incorrect because option C, "Thread(Runnable threadOb, String threadName)," is a valid constructor for the
Thread class.Therefore, the correct answer is:
C. Thread(Runnable threadOb, String threadName)