137k views
4 votes
I'm reviewing a test and can't get past this problem:

What is the difference between printing (n) and printing row[n]?

I'm reviewing a test and can't get past this problem: What is the difference between-example-1

1 Answer

4 votes

Answer:

The answer is "Option A"

Step-by-step explanation:

Following are the complete code to these question:

public class Main//defining a class-main

{

public static void main(String[] args)//main method

{

int [][] numbers={{1, 2, 3},{4,5,6}}; //defining 2D array numbers

for(int[] row : numbers) //use for loop that holds all array value into 1D array

{

for (int n: row)//defining n variable that holds row array values

{

System.out.print (n); //print n variable value

}

}

}

}

User Hixi
by
4.0k points