ExamVeda
Login
Home
This question belongs to Java Program Threads
Threads
?

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.
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Ganesh Commn
Ganesh Commn 1 year ago
A and D both are wrong