Which statements best describe the result of this code? (Choose two.)
package mypkg; //from w ww. java 2 s.c o m public class Main { public static void main(String... args) { String[] a = new String[] { "A", "B", "C" }; String[] times = new String[] { "Day", "Night" }; for (int i = 0, j = 0; i < a.length; i++, j++) System.out.println(a[i] + " " + times[j]); } }
B, E.
The first two iterations through the loop complete successfully, making Option B correct.
The two arrays are not the same size and the for loop only checks the size of the first one.
The third iteration throws an exception, making Option E correct.