Java Programming - Threads - Discussion

Discussion Forum : Threads - General Questions (Q.No. 6)
6.
Which two of the following methods are defined in class Thread?
  1. start()
  2. wait()
  3. notify()
  4. run()
  5. terminate()
1 and 4
2 and 3
3 and 4
2 and 4
Answer: Option
Explanation:

(1) and (4). Only start() and run() are defined by the Thread class.

(2) and (3) are incorrect because they are methods of the Object class. (5) is incorrect because there's no such method in any thread-related class.

Discussion:
2 comments Page 1 of 1.

Amit Kumar said:   8 years ago
run() is defined in Runnable interface instead of thread class and Thread(c) implements Runnable interface.

Ashok said:   9 years ago
What is the purpose of using terminate() in the thread?

Post your comments here:

Your comments will be displayed after verification.