举一反三
- 下列程序运行的结果为____、____int a =25;int b =a++;int c =++b;System.out.println(b);System.out.println(c);。
- 下列选项中,循环会无限执行的是______。 A: int i = 1 ; while ( i < 10) System .out .print( “ ” + i) ; B: for( int i = 1 ; i < 10 ;i ++) System .out .print( “ ” + i); C: for( int i = 10 ; i > 0 ;i --) System .out .print( “ ” + i); D: int i = 1 ; while (true) { System .out .print( “ ” + i); i ++ ; if ( i > 5) break ;
- 下面int a=7;int b=2; System.out.println(a/b) 运行结果是
- println 语句执行了多少次? for (int i = 0; i < 10;i++) for (int j = 0;j < i;j++) System .out.println(i * j)
- 在Java中,下列代码的运行结果是()int x = 10;int y = 20;if(x=y){ System.out.println(x);}else{ System.out.println(y)} A: 输出10 B: 输出20 C: 输出3 D: 编译报错
内容
- 0
下面程序的运行结果是 ____ int x=30; int[] numbers=new int[x]; x=60; System.out.println(numbers.length);
- 1
请阅读下面的程序 public class Demo { public static void sum(int a, int b) { System.out.println("int:" + (a + b)); } public static void sum(int a, float b) { System.out.println("float:" + (a + b)); } public static void sum(int a, double b) { System.out.println("double:" + (a + b)); } public static void main(String[] args) { int a = 10; long b = 20; sum(a, b); } } 下列选项中,哪一个是程序的运行结果()
- 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
写出以下程序的运行结果public class E4_1{ public static void main(String args[]) { int a = 1; int b = 2; int c = 3; a += 5; b *= 4; c += a * b; c %= 6; System.out.println("a = " + a); System.out.println("b = " + b); System.out.println("c = " + c); }}a=______ ,b=______ ,c=______ .
- 4
下列选项中,不能输出100个整数的是______。 A: A) for(int i=0;i<100;i++) B: System.out println(i) : C: B) int i=0: D: do E: System out.println(i) ; F: i++: G: while(i<100) ; H: C) int i=0: I: while(i<100) J: System.out.println(i) ; K: i++: L: D) int i=0; M: while(i<100) N: i++: O: if(i<100) continue; P: System.out.println(i) ;