中国大学MOOC: (多线程的两种实现方法)阅读下面程序:class Test implements Runnable{ public static void main(String[] args){ Test t=new Test(); t.start(); } public void run(){}}下列关于上述程序的叙述正确的是_______。
举一反三
- (多线程的两种实现方法)阅读下面程序:class Test implements Runnable{ public static void main(String[] args){ Test t=new Test(); t.start(); } public void run(){} }下列关于上述程序的叙述正确的是_______。 A: 程序不能通过编译,因为start()方法在Test类中没有定义 B: 程序编译通过,但运行时出错,提示start()方法没有定义 C: 程序不能通过编译,因为run()方法没有定义方法体 D: 程序编译通过,且运行正常
- 下列关于Test类的定义代码中,正确的是______。 A: class Test implements Runnable { public void run() {} public void someMethod() {} } B: class Test implements Runnable { public void run(); } C: class Test implements Runnable { public void someMethod(); } D: class Test implements Runnable { public void someMethod() {} }
- 下列程序的功能是在监控台上每一秒种显示一个字符串“Hello!”,能够填写在线程中下划线位置,使程序完整并能正确运行的语句是 public class Test implements Runnable{ public static void main(String args[]){ Test t=new Test(); Thread tt=new Thread(t); tt.start(); }
- 下列程序的运行结果是()public class Test {public static void main(String[] args) {String str = NULL;System.out.println(str);}} A:
- public class Test { public static void main(String[] args) { String s1 = "abc"; String s2 = new String ("abc"); System.out.println(s1 == s2); } } 程序运行结果是