试题详情
- 单项选择题 public class X implements Runnable( private int x; private int y; public static void main(Stringargs) X that = new X(); (new Thread(that)).start(); (new Thread(that)).start(); ) public void run() ( for (;;) ( x++; y++; System.out.printIn(“x=” + x + “, y = ” + y); ) ) 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̳
- public class&e
- What can d
- Which two
- Given: 11.<% 12.req
- 以下关于支持Java运行平台的叙述,哪项
- The tl:task&ens
- Which statement
- What is th
- 当对Set类型的集合使用add()方法时
- Swing允许你选择程序的图形界面风格,
- JDK由组成以下哪几部分组成?()
- 面向对象的软件开发包括哪些过程?OOA模
- 关于Java中的继承,以下说法中正确的有
- 声明局部变量时,局部变量将被赋一个默认的
- 11. public&ens
- 建立单选框需要哪些步骤?()
- public class&e
- What is th
- 下面有关java threadlocal