更多“执行下面代码结果()for(inti=0;;){System.out.println("这是"+i);break;}A、语法”相关的问题
第1题
写出程序的输出: int i=1; switch ( i%3 ) { case 0: printf("zero"); case 1: printf("one"); case 2: printf("two"); }
点击查看答案
第2题
对于以下代码: int i=6; if ( i<= 6 ) system.out.println("hello"); else system.out.println("bye-bye"); 哪句话是对的?> A、打印出“hello”
B、打印出“bye-bye"
C、不能编译
D、打印出”hello bye-bye“
点击查看答案
第3题
有如下代码段: switch(a){ case 1:System.out.println("One");break; case 2: case 3:System.out.println("Two");break; default:System.out.println("end"); } 变量a的取值是下列哪些情形时能使程序输出“Two”。
点击查看答案
第4题
下面程序片段输出的是( ) int i = 0, j = 9; do { if(i++ > --j) break; } while(i < 4); System.out.println("i = " + i + " and j = " + j);
A、i = 4 and j = 4
B、i = 5 and j = 5
C、i = 5 and j = 4
D、i = 4 and j = 5
点击查看答案
第5题
public static void main(String[] args){ for(int i=1;i<=5;i++){ if(i%2="=1)printf("*");" else continue; system.out.print ("#"); } ("$"); 以上程序的输出结果,正确的是(> A、*#$
点击查看答案
第6题
public class E{ public static void main (String[] args){ System.out.println("ok"); System.out.println("您好"); } } class A{ public static void main(String [] args){ System.out.println("ok"); System.out.println("您好"); } } 对于上面的源程序文件,()叙述是正确的 A. 源文件名字必须是A.java B. 源文件有错误 C. 源文件必须命名为E.java,编译无错误。有两个主类,E和A,程序可以执行主类E,也可以执行主类A D. 源文件的E类不是主类
点击查看答案
第7题
执行i=-1; while(i<10) i+="2;i++;">
点击查看答案
第8题
已知:int i=3;下列do-while循环语句的循环次数是()。 do { i--; } while(i != 0);
点击查看答案
第9题
6.用下列哪个代码替换程序标注的【代码】会导致编译错误?( C ) public class Exam { public static void main (String args[ ]) { int m=10, n=0; while(【代码】) { n++; } } }
A、m-->0
B、m++>0
C、m = 0
D、m>100&&true
点击查看答案