In Java, which method is used to start a thread's execution on a new call stack?
Java Programming
Threads
Difficulty: Easy
Choose an option
-
Ainit();
-
Bstart();
-
Crun();
-
Dresume();
Answer
Correct Answer: start();
Explanation
Introduction / Context:Creating and starting threads correctly is foundational to Java concurrency. The main confusion is between start() and run().
Given Data / Assumptions:
- A thread has been created by extending
Threador by passing aRunnableto aThreadconstructor.
Concept / Approach:start() transitions a thread from New to Runnable so the JVM can schedule it. The JVM then calls run() on that new thread.
Step-by-Step Solution:
1) Construct aThread object (directly or with a Runnable).2) Call start() to ask the JVM to begin execution on a new call stack.3) The JVM invokes run() on that new thread.Verification / Alternative check:Directly invoking run() executes synchronously on the current thread; only start() creates a new thread of execution.
Why Other Options Are Wrong:
init()→ applet lifecycle, not threads.run()→ body of thread; does not start a new one when called directly.resume()→ deprecated; not used to start threads.
Common Pitfalls:Forgetting to call start() and expecting parallelism.
Final Answer:start();