CSE 174 - Lab 12
(20 points): 2D Arrays
In this part you will write six static methods.
- Create a class called Lab12 and read the followingtable about the methods
you need to add into your class:
A method called getNumRows which accepts a 2D-arrayof
ints, and returns the number of rows in the given array.
Inside the main method create a 2D array and call this
method to see if this method returns the correct value. For
instance imagine an array named arr with the following
elements:
A method called getRowLength which accepts a 2D-arrayof
ints, and an int value as a row index. This method returns the
length of the given row inside the given array. If the given
row index is out of bound, this method should return zero.
Inside the main method create a 2D array and call this
method to see if this method returns the correct value. For
instance imagine an array named arr with the following
elements:
The result of getRowLength(arr, 3) should be 1.
The result of getRowLength(arr, -1) should be 0.
The result of getRowLength(arr, 5) should be 0.