• 2022-06-07
    执行以下循环后,count的值是_________? int count = 0; do { System.out.println("Welcome to Java"); } while (count++ <; 9); System.out.println(count);
    A: 8
    B: 9
    C: 10
    D: 11
  • C

    内容

    • 0

      下面的代码段执行之后count的值是什么( ) int count = 1; for (int i = 1; i <= 5; i++) { count += i; } System.out.println(count);

    • 1

      写出下列程序的输出结果 public class Test { public static void main(String&#91;&#93; args) { Count myCount = new Count(); int times = 0; for(int i=0;i<100;i++) increment(myCount , times); System.out.println(“count is” + myCount.count); System.out.println(“time is”+ times); } public static void increment(Count c , int times) { c.count++; times++; } } class Count { public int count; Count(int c) { count =c; } Count() { count =1; } }

    • 2

      下列程序的运行结果是()。 public class Test public static void main ( String [ ] args ) int count = 0 for( int i = 1 i < 5 i = 2) for( int j = 1 j< = 10 j = 3) count System .out .print (count ) _

    • 3

      以下循环的执行次数是 count=0while count<=10:print(“Programming is fun!”)count=count+1() A: 0 B: 10 C: 11 D: 死循环

    • 4

      代码中myCount.count的值为(A)?public class Test { public static void main(String&#91;&#93; args) { Count myCount = new Count(); int times = 0; for (int i=0; i&lt;100; i++) increment(myCount, times); System.out.println("myCount.count = " + myCount.count); } public static void increment(Count c, int times) { c.count++; times++; }} class Count { int count; Count(int c) { count = c; } Count() { count = 1; }} A: 101 B: 100 C: 99 D: 98