Indexing of elements in 2D array code example
Example 1: Index through 2d array
int[][]x;//define
for(int i=0;i<x.length;i++){
for(int j=0;j<x[i].length;j++){
//dp something with x[i][j]
}
}
Example 2: Index through 2d array
int[][]x;//define
for(int []y:x){
for(int a:y){
//do something with a
}
}