Question: In java, if I have a matrix (well, two arrays) with columns and rows of equal length such as below: 0 0 0 0 0
In java, if I have a matrix (well, two arrays) with columns and rows of equal length such as below:
0 0 0
0 0 0
0 0 0
How do I initialize the value of the array to equal the array number in which they are stored? I think I should use .length or .length - 1 but am a bit confused.
For example:
0 1 2
0 1 2
0 1 2
Is there a way I could do this using a for loop? I don't want to just hard code the values in.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
