0
How to find output?
How do you know what the output of a double array? For example, if the code is: int[][] myArr = {{1,2,3}.{4,5,6}}; int x = myArr[2][1]; System.out.println(x); //*how do you know what the output is?
2 Respostas
0
this code doest work:
- you need to sepperate the array with a "," not a "."
- you say myArr[2][1] but the first number is the row, and the scond number is the number in that row
0
The two arrays have an index (starts at 0) and each value have an index (starts at 0)
First array (1,2,3)
myArr[0][0] - myArr[0][2]
Second array (4,5,6)
myArr[1][0] - myArr[1][2]
5 -> myArr[1][1]
2 -> myArr[0][1]
4 -> myArr[1][0]
myArr[2][1] does not exist.