Java Programming - Threads - Discussion

Discussion Forum : Threads - General Questions (Q.No. 10)
10.
Which will contain the body of the thread?
run();
start();
stop();
main();
Answer: Option
Explanation:

Option A is Correct. The run() method to a thread is like the main() method to an application. Starting the thread causes the object's run method to be called in that separately executing thread.

Option B is wrong. The start() method causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.

Option C is wrong. The stop() method is deprecated. It forces the thread to stop executing.

Option D is wrong. Is the main entry point for an application.

Discussion:
1 comments Page 1 of 1.

KRISHNA JAYANTH said:   1 decade ago
Main() will also contain the body of a thread its always important to note that MAIN IS A THREAD of execution.

The question has to be which method contains the body of user defined thread and that would be more apt for this scenario.

Post your comments here:

Your comments will be displayed after verification.