Question 21
What will happen if you compile/run the following code?
1: public class Q21
2: {
3: int maxElements;
4:
5: void Q21()
6: {
7: maxElements = 100;
8: System.out.println(maxElements);
9: }
10:
11: Q21(int i)
12: {
13: maxElements = i;
14: System.out.println(maxElements);
15: }
16:
17: public static void main(String[] args)
18: {
19: Q21 a = new Q21();
20: Q21 b = new Q21(999);
21: }
22: }
A) Prints 100 and 999.
B) Prints 999 and 100.
C) Compilation error at line 3, variable maxElements was not initialized.
D) Compillation error at line 19.