单项选择题

for (int i =0; i < 4; i +=2) { 
System.out.print(i + “”); 
} 
System.out.println(i); 
What is the result?()  

A. 0 2 4
B. 0 2 4 5
C. 0 1 2 3 4
D. Compilation fails.
E. An exception is thrown at runtime.


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

float f[][][] = new float[3][][]; 
float f0 = 1.0f; 
float[][] farray = new float[1][1]; 
What is valid?()  

A. f[0] = f0;
B. f[0] = farray;
C. f[0] = farray[0];
D. f[0] = farray[0][0];

2.单项选择题

int x = 1, y =6; 
while (y--) { 
x++; 
} 
System.out.println(“x =” + x + “y =” +y);
What is the result?()  

A. x = 6 y = 0
B. x = 7 y = 0
C. x = 6 y = -1
D. x = 7 y = -1
E. Compilation fails.

3.单项选择题What allows the programmer to destroy an object x?()  

A. x.delete()
B. x.finalize()
C. Runtime.getRuntime().gc()
D. Explicitly setting the object’s reference to null.
E. Ensuring there are no references to the object.
F. Only the garbage collection system can destroy an object.

6.多项选择题In which two cases does the compiler supply a default constructor for class A?()  

A. class A{}
B. class A { public A(){} }
C. class A { public A(int x){} }
D. class Z {} class A extends Z { void A(){} }

10.单项选择题

1. public class A { 
2. void A() { 
3. System.out.println(“Class A”); 
4. } 
5. public static void main(String[] args) { 
6. new A(); 
7. } 
8. } 
What is the result?()  

A. Class A
B. Compilation fails.
C. An exception is thrown at line 2.
D. An exception is thrown at line 6.
E. The code executes with no output.