Why does the following class have a syntax error?() import java.applet.*; public class Test extends Applet implements Runnable { public void init() throws InterruptedException { Thread t = new Thread(this); t.sleep(1000); } public synchronized void run() { } }

发布于 2021-02-15 03:25:25
【单选题】
A The sleep() method is not invoked correctly; it should be invoked as Thread.sleep(1000).
B You cannot put the keyword synchronized in the run() method.
C The init() method is defined in the Applet class, and it is overridden incorrectly because it cannot claim exceptions in the subclass.
D The sleep() method should be put in the try-catch block. This is the only reason for the compilation failure.

查看更多

关注者
0
被浏览
92
  • 体验AI问答!更聪明、超智能!
  • 一款基于GPT的超级AI助手,可以对话、创作、写文案!
1 个回答

撰写答案

请登录后再发布答案,点击登录

发布
问题

手机
浏览

扫码手机浏览

分享
好友

在线
客服