Java Programming - Threads - Discussion


Which two of the following methods are defined in class Thread?

  1. start()
  2. wait()
  3. notify()
  4. run()
  5. terminate()

[A]. 1 and 4
[B]. 2 and 3
[C]. 3 and 4
[D]. 2 and 4

Answer: Option A


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

Ashok said: (May 31, 2016)  
What is the purpose of using terminate() in the thread?

Amit Kumar said: (Oct 19, 2017)  
run() is defined in Runnable interface instead of thread class and Thread(c) implements Runnable interface.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.