I must create a void method that increments the value of a certain row of a 2D array by 1. The row number is one of the paremeters of the method. For example, if arr is {1, 2}, {3, 3}, {1, 2}, increaseValuesOfARowByOne(arr, 3) outputs {1, 2}, {3, 3}, {2, 3}. Here is my code so far:
public static void increaseValuesOfARowByOne(int[][] arr, int rowNum)
  {
    for (int k = 0; k < rowNum; k++)
    {
      for (int j = 0; j < arr[0].length; j++) {
        (arr[rowNum][j])++;
      }
    }
    return;
  }
For the example I mentioned above, I end up getting {1, 2}, {3, 3}, {3, 4}. In other test cases I get ArrayIndexOutOfBoundsException. Not sure what to do.
 
    