logo Practice-It logo


Language/Type: Java 2D arrays array mystery
Author: Marty Stepp (on 2021/04/02)

Consider the following method:

            public static int[][] mystery1(int n) {
                int[][] result = new int[n][2 * n - 1];
                for (int i = 0; i < result.length; i++) {
                    for (int j = 0; j < result[i].length; j++) {
                        result[i][j] = i + j;
                return result;

For each call below, indicate the contents of the two-dimensional array that is returned.


You must log in before you can solve this problem.

Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.