자격증/OCJP_ExamB
QUESTION 46
IT grow.
2018. 7. 13. 19:17
반응형
QUESTION 46Given:public class Foo{static int[] a;static { a[0]=2;}public static void main( String[] args ){}}Which exception or error will be thrown when a programmer attempts to run this code?A. java.lang.StackOverflowErrorB. java.lang.IllegalStateExceptionC. java.lang.ExceptionInInitializerErrorD. java.lang.ArrayIndexOutOfBoundsExceptionSolution : C
plus imformation
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at Foo.<clinit>(Main.java:3)
Could not find the main class: Foo. Program will exit.
반응형