Difficulty: Easy
Correct Answer: An exception occurs at runtime.
Explanation:
Introduction / Context:
This question targets lifecycle rules for java.lang.Thread. Calling start() transitions a new thread from NEW to RUNNABLE. A second call to start() on the same Thread object violates the lifecycle and results in a runtime exception.
Given Data / Assumptions:
Concept / Approach:
Thread.start() may be invoked only once per Thread object. A second call throws IllegalThreadStateException, an unchecked RuntimeException. Therefore the program compiles, begins running, and then fails at the second start(). Output produced before the exception (such as "Thread " and/or "one. ") is nondeterministic, but the guaranteed outcome is a runtime exception.
Step-by-Step Solution:
Verification / Alternative check:
Replace the second start() with a fresh Thread object or call run() directly (which does not start a new thread) to avoid the exception.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing run() with start(); run() can be called multiple times but runs on the current thread.
Final Answer:
An exception occurs at runtime.
Discussion & Comments