关于以下程序代码的说明正确的是()class HasStatic{pri

10 查阅

关于以下程序代码的说明正确的是()

class HasStatic{

private static int x=100;

public static void main(String args[ ]){

HasStatic hs1=new HasStatic( );

hs1.x++;

HasStatic hs2=new HasStatic( );hs2.x++;

hs1=new HasStatic( );hs1.x++;

HasStatic.x- —;

System. out. println(“x=”+x);)

}

  • A.5行不能通过编译,因为引用了私有静态变量
  • B.10行不能通过编译,因为x是私有静态变量
  • C.程序通过编译,输出结果为:x=103
  • D.程序通过编译,输出结果为: x=102

参考答案:

D

暂无解析