A

Admin • 825.56K Points
Coach

Q. Which of the following is the correct syntax to declare and initialize a 2D array?

  • (A) int arr[][] = {{1,2},{3,4}};
  • (B) int[][] arr = new int[2,2];
  • (C) int[][] arr = [2][2];
  • (D) int arr = new int[2][2] = {{1,2},{3,4}};

Explanation by: Admin
Option A is valid syntax for initializing a 2D array.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.