✏️ Explanatory Question

Given the following 2D array:


int[][] matrix = {
    {5, 8, 3},
    {4, 9, 7},
    {6, 2, 1}
};

Write a program to display the element at the second row, third column.

👁 40 Views
📘 Detailed Answer
🟢 Easy
40
Total Views
8
Related Qs
0%
Progress
💡

Answer with Explanation


public class Main {
    public static void main(String[] args) {
        int[][] matrix = {
            {5, 8, 3},
            {4, 9, 7},
            {6, 2, 1}
        };
        
        System.out.println("Element at 2nd row, 3rd column: " + matrix[1][2]);
    }
}