Multiple choice technology programming languages

What of the following fails to cause a thread stop executing ?

  1. The program exits via a call to System.exit(0);

  2. Another thread is given a higher priority.

  3. A call to the thread's stop method.

  4. A call to the halt method of the Thread class.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A thread can stop executing if the program exits, if it's explicitly stopped with Thread.stop(), or if it is yielded to a higher priority thread. However, there is no halt method in the Thread class (which is why it fails to cause a thread to stop executing). Runtime.getRuntime().halt() exits the JVM, but it is not a method on Thread.