What is the result of the following code execution?

public class Test {
    public static void main(String[] args){
        int[][] x  = new int[2][5];
        int[][] y = new int[2][5];
        System.out.println(x[1][3]);
        System.arraycopy(x, 0, y, 0, x.length);
        x[1][3] = 55;
        System.out.println(y[1][3]);
    }
}
Explanation
Any N-dimensional array is in fact a one-dimensional array whose elements are links to N-1 dimensional arrays.
System.arraycopy copies exactly these links.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes