Name the new class as FindSmallestValues create a method with the following header to return an array
Fantastic news! We've Found the answer you've been seeking!
Question:
- Name the new class as FindSmallestValues
- create a method with the following header to return an array of integer values which are the smallest values of each row of a 2D array of integer values
public static int[] smallestValues(int[][] num)
For example, if the 2D array passed to the method is:
8 5 2 6 6
3 6 5 4 5
7 5 4 5 0
8 8 5 1 6
The method returns an array of integers which are the smallest values from each row as follows:
2
3
0
1
3. In the main method, create a 2D array of integer values with the array size 4 by 5 and invoke the method to find and display the smallest values from each row of the 2D array.
Generate the values of the 2D array using the Math.random() method with the range from 0 to 9.
Related Book For
Posted Date: