Difficulty: Easy
Correct Answer: start()
Explanation:
Introduction / Context:
Understanding the distinct roles of run()
versus start()
is essential for correct thread creation in Java.
Given Data / Assumptions:
Concept / Approach:start()
transitions a Thread from the new state to the runnable state and asks the JVM to schedule it. The VM then invokes run()
on the new thread. Calling run()
directly executes synchronously on the current thread and does not involve the scheduler.
Step-by-Step Solution:
start()
→ registers with scheduler.JVM calls run()
on the new thread.
Verification / Alternative check:
Demonstrate using prints: calling run()
executes on main thread; calling start()
spawns a new thread.
Why Other Options Are Wrong:run()
does not start a thread; construct()
, register()
, and launch()
are not Thread APIs.
Common Pitfalls:
Accidentally invoking run()
and wondering why no parallelism occurs.
Final Answer:
start()
Discussion & Comments