单选题 请阅读下面的程序并分析运行结果。 public class Test { public static void main(String[] args) { int n = 5; do { System.out.print(n--); } while (n != 0); } } 下列运行结果中,√的是( )。

A、 54321
B、 12345
C、 135
D、 不输出任何内容
下载APP答题
由4m***oh提供 分享 举报 纠错

相关试题

单选题 请阅读下面的程序并分析运行结果。 public class Test { public static void main(String[] args) { int y = 0; do { y++; if (y % 2 == 0) { continue; } System.out.print(y); } while (y < 5); } } 下列运行结果中,正确的是( )。

A、135
B、12345
C、13
D、1357

单选题 下列代码片段的输出结果是: int a = 5; if (a > 3) { System.out.println("A"); } else if (a > 4) { System.out.println("B"); } else { System.out.println("C"); }

A、A
B、B
C、C
D、无输出

单选题 下列代码片段的输出结果是: int b = 10; if (b > 5) { System.out.println("A"); } if (b > 8) { System.out.println("B"); } if (b > 12) { System.out.println("C"); }

A、A
B、A B
C、A B C
D、无输出

单选题 请阅读下面的程序并分析运行结果。 public class Test { public static void main(String[] args) { int x = 0; while (x < 5) { x++; if (x == 3) { break; } System.out.print(x); } } } 下列运行结果中,正确的是( )。

A、12
B、123
C、1234
D、12345

单选题 下列代码片段的输出结果是: int c = 7; switch (c) { case 5: System.out.println("A"); break; case 7: System.out.println("B"); System.out.println("C"); break; default: System.out.println("D"); }

A、A
B、B
C、B C
D、B C D

单选题 下列语句中,不属于循环语句的是( )。

A、do...while
B、if...else
C、for
D、while

单选题 请阅读下面的程序并分析运行结果。 public class Test { public static void main(String[] args) { int count = 0; for (int i = 0; i < 10; i++) { if (i % 2 == 0) { continue; } count++; } System.out.println(count); } } 下列运行结果中,正确的是( )。

A、0
B、5
C、10
D、15

单选题 请阅读下面的程序并分析运行结果。 public class Test { public static void main(String[] args) { int sum = 0; for (int i = 1; i <= 5; i++) { sum += i; } System.out.println(sum); } } 下列运行结果中,正确的是( )。

A、5
B、10
C、15
D、20