单项选择题

下面程序段的输出结果是( )。 public class Test { public static void main(String args[]){ int a, b; for(a=1, b=1; a<=100; a++){ if(b>=10) break; if (b%2==1) { b+=-2; continue; } } System.out.println(a); } }

A.5
B.6
C.7
D.101
<上一题 目录 下一题>
热门 试题

单项选择题
下列代码中,将引起一个编译错误的行是( )。 1)public class Test{ 2)int m,n; 3)public Test(){} 4)public Test(int a){m=a;} 5)public static void main(String args[]){ 6)Test t1,t2; 7)int j,k; 8)j=0; k=0; 9) t1=new Test(); 10)t2=new Test(j,k); 11)} 12)}
A.第3行
B.第5行
C.第6行
D.第10行
单项选择题
下列程序段运行的结果为( )。 public class Test{ static void print(String s,int i){ System.out.pdntlnC String: +s+ ,int: +i); } static void print(iht i,String s){ System.out.prinflnCint: +i+ ,gtring: +s); } public static void main(String[] args){ print(99, Int first ); } }
A.String:String first,int: 11
B.int: 11,String:Int first
C.String:String first,int:99 D. int:99,Stfing:Int first
相关试题
  • 下面不属于线程生命周期的状态的是( )。
  • 线性表的顺序存储结构和线性表的链式存储结...
  • 设树T的度为4,其中度为1,2,3,4的...
  • 下列是Java的编译命令的是( )。
  • 下列不属于面向对象编程的三个特征的是( )。