java 高级工程师面试题及答案一: 选择题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. (“x=”+x);12. }13. }A、 5 行不能通过编译,由于引用了私有静态变量B、 10 行不能通过编译,由于 x 是私有静态变量C、 程序通过编译,输出成果为:x=103D、 程序通过编译,输出成果为:x=1022
下列有关 for 循环和 while 循环的说法中哪个是对的的
( B )A.while 循环能实现的操作,for 循环也都能实现B.while 循环判断条件一般是程序成果,for循环判断条件一般是非程序成果C.两种循环任何时候都可替代D.两种循环构造中都必须有循环体,循环体不能为空3
如下选项中循环构造合法的是( C )A、while (int i