Question 8


The following code will give 1: public class Q8 2: { 3: int i = 20; 4: static 5: { 6: int i = 10; 7: 8: } 9: public static void main(String[] args) 10: { 11: Q8 a = new Q8(); 12: System.out.println(a.i); 13: } 14: } A) Compilation error, variable "i" declared twice. B) Compilation error, static initializers for initialization purpose only. C) Prints 10. D) Prints 20.
1