Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 126

Given:

Which one is correct?

    Correct Answer: A

    In Java, once a thread has been started and completes its execution, it cannot be restarted. Attempting to restart a thread by calling its start() method again will throw an IllegalThreadStateException. In the given code, the thread 't1' is started twice, which leads to an IllegalThreadStateException at runtime, making option A the correct answer.

Discussion
d7bb0b2Option: A

t1.start() => once java start a thread cannot be restarted. so Ilegal IllegalThreadStateException is thrown

OmnisumemOption: A

Tested: A.

dillemanOption: A

A is correct, tested. It works if you remove the second t1.start(); argument which is the one causing the exception.

StavokOption: A

A is correct TESTED