Answers for "Traversing a double dimensional array"

1

Traversing a double dimensional array

public class DDArray_Traverse{

  	public static void main(){
//suppose the array is stored in variable arr of size m X n
		m = 10;
        n = 10;
		int[][] arr = new int[m][n];

		for(int row = 0; row < arr.length; row++){
			for(int col = 0; col < arr[0].length; col++){
    			//do whatever operation you like
       			int element = arr[row][col]; //to access each element in the array
    		}
		}
    }
}
Posted by: Guest on February-27-2022

Code answers related to "Traversing a double dimensional array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language