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

Discussion

When an interrupted thread actually stops - which of the following is true?

  • A.An interrupted thread stops at the end of its current synchronized block.
  • B.An interrupted thread stops immediately.
  • C.An interrupted thread does not stop unless its code checks the flag or calls a blocking method.
  • D.An interrupted thread stops as soon as the current statement completes.

Answer: C

Interruption sets a flag and nothing more for a thread that is simply running; a loop that never consults it runs to completion regardless. That cooperative model is deliberate, because stopping a thread at an arbitrary point is what made stop() unsafe.

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

Post your comment

Please log in or register to post a comment.