169k views
5 votes
Which of the following is a correct method header for receiving a two-dimensional array as an argument?A.public static void passArray(int[1,2])B.public static void passArray(int [ ][ ])C.public static void passArray(int[1],[2])D.public static void passArray(in[ ], int[ ])

User Gene T
by
5.1k points

1 Answer

4 votes

Answer:

The correct option for this question is "B".

Explanation:

An Array is a collection of the homogenous(same type) elements. In the programming language, the correct way to pass two-dimensional array in function as an argument is option "B" and other options are not correct that can be described as:

  • In option, A It is a one-dimensional array but it is not a correct way to pass array in an argument like this.
  • In option, C It is a two-dimensional array but in this array, we do not pass any number.
  • In option, D it is not a two-dimensional array.

That's why the answer to this question is option "B".

User Roseni
by
5.3k points