单项选择题
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.
点击查看答案&解析
相关考题
-
单项选择题
Whatallowstheprogrammertodestroyanobjectx?()
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. -
单项选择题
1. public class Outer{ 2. public void someOuterMethod() { 3. // Line 3 4. } 5. public class Inner{} 6. public static void main( String[]argv ) { 7. Outer o = new Outer(); 8. // Line 8 9. } 10. } Which instantiates an instance of Inner?()
A. new Inner(); // At line 3
B. new Inner(); // At line 8
C. new o.Inner(); // At line 8
D. new Outer.Inner(); // At line 8 -
单项选择题
1. public class ReturnIt { 2. return Type methodA(byte x, double y) { 3. return (short)x / y * 2; 4. } 5. } What is the narrowest valid returnType for methodA in line2?()
A. int
B. byte
C. long
D. short
E. float
F. double
