Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 5: Writing Classes
Start Practice TestPractice Test
About Exam
hard Solved by 1 students

Java Thread Interruption Behavior

Mark
< Prev
Next >

Consider the InterruptExample class provided below. What is the outcome if a thread executing the run method is interrupted during the call to wait()?

public class InterruptExample implements Runnable {
    public void run() {
        synchronized(this) {
            try {
                wait();
            } catch (InterruptedException e) {
                System.out.println("Interrupted!");
            }
        }
    }
}
A

It will silently resume execution without any notification.

B

It will cause the program to terminate immediately.

C

It will enter a deadlock state and never resume.

D

It will throw an InterruptedException, catch it, and print “Interrupted!”.

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|