题库 软件开发 题目列表 以下代码运行后会打印哪些内容 public class Test imp...
单选题
以下代码运行后会打印哪些内容
public class Test implements Runnable {
    @Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            synchronized (this) {
            try {
                wait();
            } catch (InterruptedException e) {
                System.out.println("InterruptedException");
            }
        }
    }
    System.out.println("Final");
}
public static void main(String[] args) throws InterruptedException {
    Thread thread = new Thread(new Test());
    thread.start();
    new Thread(() -> {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
        thread.interrupt();
        System.out.println("interrupt");
    }).start();
    thread.join();
    System.out.println("exit");
    }
}

A.

interrupt、InterruptedException

B.

exit、interrupt、InterruptedException

C.

exit、interrupt、InterruptedException、final

D.

interrupt、InterruptedException、final

题目信息
校招真题
-
正确率
0
评论
19
点击