Hello,
My name is Steven and I am studying for the OCA-JP-SE7 (1Z0-803) exam and I am using Enthuware Test Studio for practice questions. I came across a question that has to do with the arraycopy method and am having some trouble understanding exactly what is happening. Here is the code that is used in the question:
class ArrayCopy {
public static void main(String[] args) {
int[] scores = {1, 2, 3, 4, 5, 6};
System.arraycopy(scores, 2, scores, 3, 2);
for(int i : scores) System.out.print(i);
}
}
I know the answer is 123346 but I don't get why. Oracle shows this arraycopy(Object src, int srcPos, Object dest, int destPos, int length) which I thought I understood but my incorrect thinking had me choosing 123356 as the answer. I suspect my problem in understanding this is to do with the length part of the method parameter. Can someone help with what am I not getting?