Thread lifecycle — which method actually registers a new thread with the scheduler and starts it?

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:

  • You have a Thread instance or a Thread constructed with a Runnable target.
  • You need to begin execution on a new call stack.


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:

Create a Thread (or Runnable + Thread).Call 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()

More Questions from Threads

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion