Given the code fragment:
What is the result?
A.
Execution terminates in the first catch statement, and caught a RuntimeException is printed to the console.
B.
Execution terminates in the second catch statement, and caught an Exception is printed to the console.
C.
A runtime error is thrown in the thread “main”.
D.
Execution completes normally, and Ready to use is printed to the console.
E.
The code fails to compile because a throws keyword is required.
Answer: C:
Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3210)
at java.util.Arrays.copyOf(Arrays.java:3181)
at java.util.ArrayList.grow(ArrayList.java:265)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:239)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:231)
at java.util.ArrayList.add(ArrayList.java:462)
at q074.Test.main(Test.java:11)
C
C