下列程序打印( )次“Welcome to Java”?[br][/br] int count = 0; do { System.out.println("Welcome to Java"); count++; } while (count < 10);
举一反三
- 循环后count的值是什么? ( )int count = 0;do { System.out.println("Welcome to Java"); count++;} while (count A: 10 B: 11 C: 9 D: 8
- 执行以下循环后,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
- 给定一个Java程序的代码如下所示,则编译运行后,输出结果是 ( )。 public class Test { int count = 9; public void count() { System.out.println("count=" + count++); } A: blic static void main(String args[]) new Test().count(); new Test().count();}} B: count=9 count=9 C: count=10 count=9 D: count=10 count=10 E: count=9 count=10
- 假设pa标识字符串"changhai",则如下程序输出__________。 void MyStrlen(char *pa){ int count=0; while(*pa != '\0'){ pa++; count++; } printf("%d",count); }
- 写出下列程序的输出结果 public class Test { public static void main(String[] 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; } }