题目
下面程序的正确输出是()。 public class Hello { public static void main(String args[]) { int count, xPos=25; for (count=1; count<=10; count++ ) { if (count==5 ) break; System.out.println(count ); xPos += 10; } } }
A.1 2 3 4
B.1 3 4
C.编译错误
D.以上都不是
第1题
运行下面程序后,正确的输出结粜是()。 public class Sun { public static void main(String args[]) { int x=6; if(x>6) System.out.printin("x>6"); else if(x<8) System.out.println("X<8"); else if(x==6) System.out.println("x=6"); } }
A.x<8x=6
B.x<8
C.x=6
D.x<8或x=6
第2题
下面程序的正确输出是()。 public class Hello { public static void main(String args[]) { int count, xPos = 25; for (count = 1; count <= 10; count++ ) { if (count == 5 ) break; System.out.println(count ); xPos += 10; } } }
A.1 2 3 4
B.1 3 4
C.编译错误
D.以上都不是
第3题
A.输出0
B.编译错误
C.运行时刻异常
D.输出为空
第4题
下面程序的正确输出是()。 public class Hello { public static void main(String args[]) { int count,xPos=25; for(count=1;count<=10;count++) { if(count= =5) Break; system.Out.println(count); xPos+=10: } } }
A.1 2 3 4
B.1 3 4
C.编译错误
D.以上都不正确
第5题
阅读下面程序 public class ExampleStringBuffer { public static void main(String[] args) { StringBuffer sb=new StringBuffer("test"); System.out.println("buffer="+sb); System.out.println("length="+sb.length()); } } 程序运行结果中,在“length=”后输出的值是
A.10
B.4
C.20
D.30
第6题
下面程序片段的执行中,说法正确的是()。 public class Test { public static void main (String args[]) { byte y=20; int i=y; int x=100; y=x; System.out.println(y); } }
A.输出y的值为100
B.第4行错误
C.输出y的值为20
D.第6行错误
第7题
A.输出0
B.编译错误
C.运行时刻异常
D.输出为空
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!