试题详情
- 单项选择题 1. public class X implements Runnable( 2. private int x; 3. private int y; 4. 5. public static void main(String[]args) 6. X that = new X(); 7. (new Thread(that)).start(); 8. (new Thread(that)).start(); 9. ) 10. 11. public void run() ( 12. for (;;) ( 13. x++; 14. y++; 15. System.out.printIn(“x=” + x + “, y = ” + y); 16. ) 17. ) What is the result?()
A、 Errors at lines 7 and 8 cause compilation to fail.
B、 The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”).
C、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”).
D、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1” followed by “x=2, y=2”).
- D
关注下方微信公众号,在线模考后查看
热门试题
- Which two̳
- Click the
- public class&e
- 企业发放的奖金根据利润提成。利润(I)低
- 编写一个字符界面的JavaApplica
- 已知: 下面哪些代码是对构造函数的重载
- 文本框的常用功能函数和属性有哪些?()
- JVM在执行一个Java类时,大致采用以
- 用于生成Java文档的JDK工具是?()
- Which two̳
- 什么是递归方法?递归方法有哪两个基本要素
- 已知: 在横线处添加哪条语句运行时会产
- 试列举出图形用户界面中你使用过的组件。
- Given thatQ
- 在一个正整数序列中,第一项是1978,第
- 下面程序的运行结果:()。
- 表达式““.equals(null)的结
- 在方法的声明中,要求该方法必须抛出异常时
- You have
- Which statemen