x > 0
x > -3
x <= -3
x <= 0 & x > -3
第1题:
给出下面程序段: if(x>0){System.out.println("Hello.");} else if(x>-3){ System.out.println("Nice to meet you!");} else{System.out.println("How are you?");} 若打印字符串"How are yoh?",则x的取值范围是( )。
A.x>0
B.x>-3
C.x≤-3
D.x≤0&x>-3
第2题:
给出下列代码片段: if(x>0){System.out.println("first");} else if(x>-3){System.out.println("second");} else{System.out.println("third");} 当x处于( )范围时打印字符串"second"。
A.x>0
B.x>-3
C.-3<x<=0
D.x<=-3
第3题:
public class Foo { public void main( String[] args ) { System.out.println( “Hello” + args[0] ); } } What is the result if this code is executed with the command line?()
第4题:
Given the following code: 1) public void modify() { 2) int i, j, k; 3) i = 100; 4) while ( i > 0 ) { 5) j = i * 2; 6) System.out.println (" The value of j is " + j ); 7) k = k + 1; 8) i--; 9) } 10) } Which line might cause an error during compilation?()
第5题:
Given the following code: public class Person{ int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1]); } } Which statement is correct?()
第6题:
line 4
line 6
line 7
line 8
第7题:
Code fragment a.
Code fragment b.
Code fragment c.
Code fragment d.
Code fragment e.
第8题:
a++;
b++;
c++;
d++;
e++;
第9题:
第10题:
x > 0
x > -3
x <= -3
x <= 0 & x > -3
第11题:
When compilation some error will occur.
It is correct when compilation but will cause error when running.
The output is zero.
The output is null.
第12题:
Line 5 will not compile, because void methods cannot be overridden.
Line 12 will not compile, because there is no version of test() that rakes a charargument.
The code will compile but will throw an exception at line 12.
The code will compile and produce the following output: I am an int.
The code will compile and produce the following output: I am a String.
第13题:
下列代码中 if(x>O){System.out.println("first");} elseif(x>-3){System.out.println("second");) else{System.out.println("third");) 要求打印字符串为“second”时,X的取值范围是( )。
A.x<=0且x>-3
B.x>0
C.x>-3
D.x<=-3
第14题:
Given the following code: if (x>0) { System.out.println("first"); } else if (x>-3) { System.out.println("second"); } else { System.out.println("third"); } Which range of x value would print the string "second"?()
第15题:
What will be the result of attempting to compile and run the following code?() public class Q6b0c { public static void main(String args[]) { int i = 4; float f = 4.3; double d = 1.8; int c = 0; if (i == f) c++; if (((int) (f + d)) == ((int) f + (int) d)) c += 2; System.out.println(c); } }
第16题:
Given the following code fragment: 1) String str = null; 2) if ((str != null) && (str.length() > 10)) { 3) System.out.println("more than 10"); 4) } 5) else if ((str != null) & (str.length() < 5)) { 6) System.out.println("less than 5"); 7) } 8) else { System.out.println("end"); } Which line will cause error?()
第17题:
Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?() CODE FRAGMENT a: public static void main(String args[]) { if (args.length != 0) System.out.println(args[args.length-1]); } CODE FRAGMENT b: public static void main(String args[]) { try { System.out.println(args[args.length]); } catch (ArrayIndexOutOfBoundsException e) {} } CODE FRAGMENT c: public static void main(String args[]) { int ix = args.length; String last = args[ix]; if (ix != 0) System.out.println(last); } CODE FRAGMENT d: public static void main(String args[]) { int ix = args.length-1; if (ix > 0) System.out.println(args[ix]); } CODE FRAGMENT e: public static void main(String args[]) { try { System.out.println(args[args.length-1]); }catch (NullPointerException e) {} }
第18题:
foreach(x)System.out.println(z);
for(intz:x)System.out.println(z);
while(x.hasNext())System.out.println(x.next());
for(inti=0;i
第19题:
The code will fail to compile.
0 will be written to the standard output.
1 will be written to the standard output.
2 will be written to the standard output.
3 will be written to the standard output.
第20题:
When compilation some error will occur.
It is correct when compilation but will cause error when running.
The output is zero.
The output is null.
第21题:
line 1
line 2
line 5
line 8
第22题:
i.v is guaranteed always to be 0 or 1.
j.v is guaranteed always to be 0 or 1.
k.v is guaranteed always to be 0 or 1
j.v will always be greater than or equal to k.v at any give time.
k.v will always be greater than or equal to j.v at any give time.
第23题:
The value is 8
The value is 9
The value is 10
The value is 11
第24题:
foreach(x) System.out.println(z);
for(int z : x) System.out.println(z);
while( x.hasNext()) System.out.println( x.next());
for( int i=0; i< x.length; i++ ) System.out.println(x[i]);