当前位置:SCJP程序员认证考试题库

问题:

[单选]

public class X implements Runnable (  
private int x;  
private int y;  
 public static void main(String args) (  
X that = new X();  
(new Thread(that)) . start( ); 
 (new Thread(that)) . start( );  
)  
 public synchronized void run( ) (  
 for (;;) (  
 x++;  
 y++;  
 System.out.printIn(“x = “ + x + “, y = “ + y);  
 ) 
 )  
 )  
What is the result?()

A .  An error at line 11 causes compilation to fail.
B .  Errors at lines 7 and 8 cause compilation to fail.
C .  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”)
D .  The program prints pairs of values for x and y that are always the same on the same line (forexample, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by  “x=1, y=1”)
E .  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=2s, y=2”)

什么是终身教育? 物修复金属污染的方式:植物固定;植物();植物()。 简述防止危机发生的措施有哪些? 教育经费包括哪些? 细胞壁的主要化学万分是纤维素,构成细胞壁的结构单位是() 微纤丝。 微丝。 微管。 微粒体。

public class X implements Runnable (  
private int x;  
private int y;  
 public static void main(String args) (  
X that = new X();  
(new Thread(that)) . start( ); 
 (new Thread(that)) . start( );  
)  
 public synchronized void run( ) (  
 for (;;) (  
 x++;  
 y++;  
 System.out.printIn(“x = “ + x + “, y = “ + y);  
 ) 
 )  
 )  
What is the result?()

参考答案:

  参考解析

本题暂无解析

在线 客服