Which statement is true about this code?
1. class MyClass 2. { /*from w w w .j a v a 2s . c om*/ 3. private static int x = 100; 4. 5. public static void main(String args[]) 6. { 7. MyClass hs1 = new MyClass(); 8. hs1.x++; 9. MyClass hs2 = new MyClass(); 10. hs2.x++; 11. hs1 = new MyClass(); 12. hs1.x++; 13. MyClass.x++; 14. System.out.println("x = " + x); 15. } 16. }
E.
The program compiles fine.
The static variable x gets incremented four times, on lines 8, 10, 12, and 13.