Unverified Commit cd814fdc authored by Lokesh Singh's avatar Lokesh Singh Committed by GitHub

Create accessing 2d array.java

parent 79db37a3
import java.io.*;
import java.util.*;
public class solution {
public static void main(String[] args) {
int[][] arr = {{2, 5},
{4, 0},
{9, 1}};
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
System.out.println("arr[" + i + "][" + j + "] = " + arr[i][j] + " ");
}
}
}
}
// Output:
// arr[0][0] = 2
// arr[0][1] = 5
// arr[1][0] = 4
// arr[1][1] = 0
// arr[2][0] = 9
// arr[2][1] = 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment