问题描述:
[单选]
class MyThread implements Runnable { 2. public void run(){ 3. System.out.print("go "); 4. } 5. 6. public static void main(String [] args){ 7. // insert code here 8. t.start(); 9. } 10. } 和如下四句: Thread t = new MyThread(); MyThread t = new MyThread(); Thread t = new Thread(new Thread()); Thread t = new Thread(new MyThread()); 分别插入到第5行,有几个可以通过编译?
A.0
B.1
C.2
D.3
参考答案:查看无
答案解析:无
☆收藏
答案解析:无
☆收藏
上一篇:class ThreadExcept implements Runnable { public void run(){ throw new RuntimeException("exception "); } public static void main(String [] args){ new Thread(new ThreadExcept()).start(); try { int x = Integer.parseInt(args[0]); Thread.sleep(x); System.out.print("main "); } catch (Exception e){ } } } 和命令行( ) java ThreadExcept 1000 哪一个是结果?
下一篇:class Order2 implements Runnable { 6. public void run(){ 7. for(int x = 0; x 〈 4; x++){ 8. try { Thread.sleep(); } catch (Exception e){ } 9. System.out.print("r"); 10. } } 11. public static void main(String [] args){ 12. Thread t = new Thread(new Order2()); 13. t.start(); 14. for(int x = 0; x 〈 4; x++){ 15. // insert code here 16. System.out.print("m"); 17. } } } 哪一个插入到第15行,最有可能产生输出 rmrmrmrm ?
- 我要回答: 网友(3.144.91.130)
- 热门题目: 1.如果月末收入的材料,即未付款 2.覆盖分析之前,需获取优化目标 3.房地产可行性研究报告的内容包