- 3
- 0
- 约5.98千字
- 约 8页
- 2019-09-24 发布于安徽
- 举报
一:选择题
1. 关于以下程序代码的说明正确的是( D )
1.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、 5行不能通过编译,因为引用了私有静态变量
B、 10行不能通过编译,因为x是私有静态变量
C、程序通过编译,输出结果为:x=103
D、程序通过编译,输出结果为:x=102
2. 下列关于for循环和while循环的说法中哪个是正确的?( B )
A.while循环能实现的操作,for循环也都能实现
B.while循环判断条件一般是程序结果,for循环判断条件一般是非程序结果
C.两种循环任何时候都可替换
D.两种循环结构中都必须有循环体,循环体不能为空
3.以下选项中循环结构合法的是
原创力文档

文档评论(0)