Which line rests on a mistaken assumption?
public class Sample61
{
public static void main(String[] args) throws Exception
{
Thread t = new Thread(() -> { assert false : "worker"; });
t.start();
t.join();
System.out.println("main finished");
}
}
Answer: A
An AssertionError thrown inside a worker thread kills only that thread. join returns normally, main prints and exits with a success status, and the failure is easy to miss in the log. An assertion is only as useful as the thread that reports it, so worker threads need their own handler.
Please log in or register to report this question.