My issue
what are the test cases
My code
class TwoDArrayExample {
public static void main(String[] args) {
// Declare the 2D array variable
int[][] myArray;
// Using an array initializer to initialize the 2D array
myArray = new int[][] {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
// Accessing elements in the 2D array
int element = myArray[1][2];
// Printing the complete array
for (int i = 0; i < myArray.length; i++) {
for (int j = 0; j < myArray[i].length; j++) {
System.out.print(myArray[i][j] + " ");
}
System.out.println();
}
// Print the accessed element
System.out.println("Element at row 1, column 2: " + element);
}
}
Learning course: Introduction to Java
Problem Link: 2D arrays Practice Problem in Introduction to Java - CodeChef