Java Basics - 2D Arrays and Nested Loops
2D Arrays
int dimensions[] [] where the first box is along the y axis and then the x axis.
In programming 'i' represents the column and 'j' represents the row
For example:
grid[i][j]
grid[column][row]
________________________________________
Nested Loops
for(int i = 0; i<3; i++){ //this is the outer loop
for(int j=0; j<3; j++){ //this is the inner loop
System.out.println("What, where, who, when!");
}
}
The above message repeats 3 times x 3 times. Giving the printing the line 9 times over.
int dimensions[] [] where the first box is along the y axis and then the x axis.
In programming 'i' represents the column and 'j' represents the row
For example:
grid[i][j]
grid[column][row]
________________________________________
Nested Loops
for(int i = 0; i<3; i++){ //this is the outer loop
for(int j=0; j<3; j++){ //this is the inner loop
System.out.println("What, where, who, when!");
}
}
The above message repeats 3 times x 3 times. Giving the printing the line 9 times over.
Comments
Post a Comment