Consider the following incomplete method that is intended to return an array that contains the contents of its first array parameter follow by contents of its second array parameter.
public static int[] appen(int[] al, int[] a2)
{
int[] result = new int[al.length + a2.length]
for (int j = 0; j < al.length; j++)
result[j] = al[j];
for (int k = 0; k < a2.length; k++)
result[ / index / ] = a2[k]
return result;
}
Which of the following expressions can be used to replace / index / so that append will work as intended?
(A) j
(B) k
(C) k + al.length - 1
(D) k + al.length
(E) k + al.length + 1



Answer :

Other Questions