Displaying the largest number from the column with the smallest number

In the previous example, we observed how to print the smallest number from the array matrix. In this example, we will look for the smallest number in the matrix and then the maximum number in the same column. The logic behind this is: we first find the minimum number, remember the row number it belongs to, and extract the maximum number in the same column.

Let's use the same matrix that we used in the previous example. The output for this exercise in the matrix that we are using will be 4. The following steps will be implemented to perform this exercise:

  1. Find the minimum value in the matrix that we declare
  2. Identify the column of that minimum number
  3. Find the maximum number ...

Get Hands-On Automation Testing with Java for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.