Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which one of the following statements about an exception thrown out of run() is true?

  • A.An exception thrown out of run() ends only that thread; other threads keep running.
  • B.An exception thrown out of run() terminates the JVM.
  • C.An exception thrown out of run() propagates to the thread that called start().
  • D.An exception thrown out of run() is silently discarded with no report of any kind.

Answer: A

A thread dies either by returning from run() or by throwing an exception that propagates beyond it, and that death is local to the thread. It cannot be caught by whoever called start(), because that call returned long before. The uncaught exception handler reports it, so it is not silent.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.