首页 试题广场 > 试题详情
单选题

【C014010】关于以下程序代码的说明正确的是?

1. public class HasStatic{
2. private static int x=100;
3. public static void main(String args[]){
4. HasStatic hs1=new HasStatic();
5. hs1.x++;
6. HasStatic hs2=new HasStatic();
7. hs2.x++;
8. hs1=new HasStatic();
9. hs1.x++;
10. HasStatic.x--;
11. System.out.println("x="+x);
12. }
13. }

  • A.程序通过编译,输出结果为:x=103
  • B.10行不能通过编译,因为x是私有静态变量
  • C.5行不能通过编译,因为引用了私有静态变量
  • D.程序通过编译,输出结果为:x=102
提交并查看答案
下一题 上一题
Ke星伙伴们的回答/ 8个回答
关闭
关闭
QQ
交流群
邀请
好友
App
下载
意见
反馈
返回
顶部