Respuesta :
Answer:
In Java:
import java.util.Scanner; Â
import java.util.Arrays; Â
public class Main  { Â
public static void main(String args[]) Â { Â
Scanner input = new Scanner(System.in);
int row, col; Â
System.out.print("Rows: "); Â Â row = input.nextInt();
System.out.print("Cols: "); Â Â col = input.nextInt(); Â
int[][] Array2D = new int[row][col];
System.out.print("Enter array elements: ");
for(int i =0;i<row;i++){ Â Â
  for(int j =0;j<col;j++){
    Array2D[i][j] = input.nextInt(); Â
  }   }
Â
int[] maxarray = findmax(Array2D,row,col);
System.out.println("Row: "+(maxarray[0]+1));
System.out.println("Column: "+(maxarray[1]+1));
} Â
public static int[] findmax(int[][] Array2D,int row, int col) Â { Â
int max = Array2D[0][0];
int []maxitem = new int [2];
for(int i =0;i<row;i++){
  for(int j =0;j<col;j++){
    if(Array2D[i][j] > max){ Â
      maxitem[0] = i;
      maxitem[1] = j; } }   }
Â
return maxitem; Â
} Â
}
Explanation:
The next two lines import the scanner and array libraries
import java.util.Scanner; Â
import java.util.Arrays; Â
The class of the program
public class Main  { Â
The main method begins here
public static void main(String args[]) Â { Â
The scanner function is called in the program
Scanner input = new Scanner(System.in);
This declares the array row and column
int row, col;
This next instructions prompt the user for rows and get the row input Â
System.out.print("Rows: "); Â Â row = input.nextInt();
This next instructions prompt the user for columns and get the column input Â
System.out.print("Cols: "); Â Â col = input.nextInt(); Â
This declares the 2D array
int[][] Array2D = new int[row][col];
This prompts the user for array elements
System.out.print("Enter array elements: ");
The following iteration populates the 2D array
for(int i =0;i<row;i++){ Â Â
  for(int j =0;j<col;j++){
    Array2D[i][j] = input.nextInt(); Â
  }   }
This calls the findmax function. The returned array of the function is saved in maxarray Â
int[] maxarray = findmax(Array2D,row,col);
This prints the row position
System.out.println("Row: "+(maxarray[0]+1));
This prints the column position
System.out.println("Column: "+(maxarray[1]+1));
The main method ends here
} Â
The findmax function begins here
public static int[] findmax(int[][] Array2D,int row, int col) Â { Â
This initializes the maximum to the first element of the array
int max = Array2D[0][0];
This declares maxitem. The array gets the position of the maximum element
int []maxitem = new int [2];
The following iteration gets the position of the maximum element
for(int i =0;i<row;i++){
  for(int j =0;j<col;j++){
    if(Array2D[i][j] > max){ Â
      maxitem[0] = i; -- The row position is saved in index 0
      maxitem[1] = j;  -- The column position is saved in index 1} }   }
This returns the 1 d array
return maxitem; Â
} Â