Which of these statement is incorrect?

Which of these statement is incorrect?
A. A thread can be formed by implementing Runnable interface only
B. A thread can be formed by a class that extends Thread class
C. start() method is used to begin execution of the thread
D. run() method is used to begin execution of a thread before start() method in special cases
 
Answer: d
Explanation: run() method is used to define the code that constitutes the new thread, it contains the code to be executed. start() method is used to begin execution of the thread that is execution of run(). run() itself is never used for starting execution of the thread.
 

Tìm kiếm

Back
Top