Difficulty: Easy
Correct Answer: run();
Explanation:
Introduction / Context:
Understanding the lifecycle of a Java thread is essential for writing concurrent programs. A frequent confusion is between the method that starts a thread and the method that actually executes on the new thread.
Given Data / Assumptions:
Concept / Approach:
The start()
method asks the JVM to create a new thread of execution, whereas the run()
method is the entry point for the work performed by that thread. The developer places the thread's body (business logic) inside run()
.
Step-by-Step Solution:
run()
in a Thread subclass or provide a Runnable
whose run()
implements the task.2) Call start()
on the Thread instance to transition from New to Runnable; the JVM will then invoke run()
on the new thread.3) The code inside run()
is what executes concurrently.
Verification / Alternative check:
Calling run()
directly from the main thread executes synchronously (no new thread). Only start()
spawns a new thread that then calls run()
.
Why Other Options Are Wrong:
start()
→ starts the thread but doesn't contain the work.stop()
→ deprecated, dangerous; not the body.main()
→ process entry point, not a thread's body.
Common Pitfalls:
Beginners often call run()
directly, mistakenly assuming it starts a new thread.
Final Answer:
run();
Discussion & Comments