If we have a 2D array int[][] arr, the expression arr[i] refers to the __________.

  • an error
  • entire array
  • ith column of the array
  • ith row of the array
In a 2D array in Java, arr[i] refers to the ith row of the array. This is because a 2D array is essentially an array of arrays, where each element arr[i] is itself an array representing a row. Accessing arr[i] gives you the entire row at index i.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *