单项选择题

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.


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题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.

4.多项选择题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(){} }

8.单项选择题

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.

最新试题

What is the result?()

题型:单项选择题

Which statement is true?()

题型:单项选择题

A programmer iterates over the TreeSet and prints the name of each Drink object.  What is the result?()

题型:单项选择题

Given:  foo and bar are public references available to many other threads, foo refers to a Thread and bar is an Object. The thread foo is currently executing bar.wait().  From another thread, what provides the most reliable way to ensure that foo will stop executing wait()?()

题型:单项选择题

A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap.  Which two methods should be overridden to assure that Key works correctly as a key?()

题型:多项选择题

What is the result?()

题型:单项选择题

Given that Triangle implements Runnable, and:Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute?()

题型:多项选择题

What is the result?()

题型:单项选择题

What is the result?()

题型:单项选择题

Which statement is true?()

题型:单项选择题