问题 单项选择题

下面是一个Java的应用程序,其输出结果是( )。  public class Testll{   public static void main (String args[ ])   { char c=''i'';    for(int n;6;n<11;m + +)    { if(n = =8)continue;     System.out.print(c + +);     }    }  }

A.Hello,World!

B.Hello,

C.World!

D.该程序段有语法错误

答案

参考答案:A

解析:在本题中使用了If语句与GoTo语句。当c<10时,输出c,并继续运行;当大于10时,显示“10以内的奇数显示完毕。”并结束程序。开始时,a=2,c=1,执行语句c=c+a后c为3,小于10,故输出c的值3,所以本题的正确答案为选项A)。

选择题
多项选择题