

MCQOPTIONS
Saved Bookmarks
1. |
What is the output of this program? class access { static int x; void increment() { x++; } } class static_use { public static void main(String args[]) { access obj1 = new access(); access obj2 = new access(); obj1.x = 0; obj1.increment(); obj2.increment(); System.out.println(obj1.x + " " + obj2.x); } } |
A. | 1 2 |
B. | 1 1 |
C. | 2 2 |
D. | Compilation Error |
Answer» D. Compilation Error | |