Card 4 / 37: int[] a = new int[0]; a[0] = 5; System.out.println(a[0]);
A)
5
B)
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at ocjp.Test.main(Test.java:7)
C)
Compilation error, arrays cannot be initialized to zero size
D)
Compilation error, it is a.length() not a.length
Answer:
B) Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at ocjp.Test.main(Test.java:7)
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
|