Answer:
Following are the code to this question:
import java.util.*;//import package
public class Main //defining a class
{
public static void main(String[] ax)//defining main method
{
int student[][] = {{50,60,65},{75,85,90}}; //defining double array student
int Row=0,Col=0;//defining integer variable
double x;//defining double variable
for (int a = 0; a <student.length; a++)//use for loop to holding row value
{
for (int b = 0; b<student[a].length; b++)//use for loop to holding column value
{
Row += student[a][b];//add row value
Col += student[0][b];//add column value
}
}
System.out.println(x=Row/2);//dividing value and calculating average value
}
}
Output:
212.0
Explanation:
In the above code, a 2D array student is declared, that holds some value in the next step, two integer variable "Row and Col", is declared, which it uses the for loop to add value in "Row and Col", and in the next step, a double variable x is declared, that add value and calculates its average value and store its value in x variable and print its value.