?
Which of these statement is incorrect?
Answer & Solution
Correct Answer:
Option
D
Option A is correct: You can create a thread by implementing the Runnable interface. Your class provides the run() method, which contains the code the thread will execute.
Option B is correct: You can also create a thread by extending the Thread class. This is another way to define what the thread will do within the run() method.
Option C is correct: The start() method is crucial. It's what actually initiates the thread's execution. It prepares the thread and then calls the run() method in a separate thread of execution.
Option D is incorrect: You should never call the run() method directly to start a thread. Calling run() directly simply executes the code within the run() method in the current thread, rather than creating a new thread. To properly start a thread, you must use the start() method.
Option B is correct: You can also create a thread by extending the Thread class. This is another way to define what the thread will do within the run() method.
Option C is correct: The start() method is crucial. It's what actually initiates the thread's execution. It prepares the thread and then calls the run() method in a separate thread of execution.
Option D is incorrect: You should never call the run() method directly to start a thread. Calling run() directly simply executes the code within the run() method in the current thread, rather than creating a new thread. To properly start a thread, you must use the start() method.
Join the Discussion
Login to post a comment or share your explanation.
Login