🎴 Flashcard Mode

Mixed Programming Languages Quiz: SAS, ABAP, and Java

Card1 / 20
Mastered0
Review0
QuestionClick to flip

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

AnswerClick to flip back
A
Prints BC and Runtime Exception
💡 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.

Change Mode