Which statement is true about this application?
1. class MyClass 2 { /*from w w w .j a va2 s. c o m*/ 3. static int x = 10; 4. 5. static { x += 5; } 6. 7. public static void main(String args[]) 8. { 9. System.out.println("x = " + x); 10. } 11. 12. static {x /= 5; } 13. }
E.
Multiple static initializers (lines 5 and 12) are legal.
All static initializer code is executed at class-load time.
Before main()
is ever run, the value of x is initialized to 10 (line 3), then bumped to 15 (line 5), and then divided by 5 (line 12).