85.1k views
0 votes
Int[][] myvals = {{2, 4, 6, 8}, {20, 40, 60, 80} };​using the above two-dimensional array, what is the value of myvals[1][2]?

1 Answer

2 votes

Answer:

myvals[1][2] = 4

Explanation:

Int[][] myvals = {{2, 4, 6, 8}, {20, 40, 60, 80} }

This command means that we have the following matrix:


\left[\begin{array}{cccc}2&4&6&8\\20&40&60&80\end{array}\right]

using the above two-dimensional array, what is the value of myvals[1][2]?

This is the element at first row, column 2.

First row is {2, 4, 6, 8}

First row, column 2 is 4. So

myvals[1][2] = 4

User James Hutchinson
by
3.4k points