Multiple choice technology programming languages

class C { public static void main (String[] a1) { System.out.print(a1[1] + a1[2] + a1[3]); }} What is the result of attempting to compile and run the program? java command A B C

  1. Prints: ABC

  2. Prints BC and Runtime Exception

  3. Prints: BCD

  4. Runtime Exception

  5. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The execution arguments passed are A, B, and C, corresponding to indices 0, 1, and 2. Printing a1[1] + a1[2] outputs BC, but accessing a1[3] subsequently throws an ArrayIndexOutOfBoundsException at runtime.