Multiple choice technology architecture

What will be printed out if this code is run with the following command line? java myprog good morning public class myprog{ public static void main(String argv[]) { System.out.println(argv[2]); } }

  1. myprog

  2. good

  3. morning

  4. Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"

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

Command-line arguments populate argv array starting from index 0. With only two arguments ('good', 'morning'), argv[2] is out of bounds, throwing ArrayIndexOutOfBoundsException: 2.