I could not get this past my editor, and am not bright enough to understand why. My TA and I do not share a common language fluency and I do not understand remotely what he is saying. Can anyone tell me why this doesn't run?

import java.util.Scanner;
public class sumMatrix1 {


	/**
	 * @param args 
	 */
	public static double sumMatrix1(int[][] m){
		// TODO Auto-generated method stub
		int matrix[][] = new int[4][4];
		System.out.print("Enter the first row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[0][i] = (int) input.nextDouble();
		} 
		System.out.print("Enter the second row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[1][i] = (int) input.nextDouble();
		}
		System.out.print("Enter the third row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[2][i] = (int) input.nextDouble();
		}
		System.out.print("Enter the fourth row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[3][i] = (int) input.nextDouble();
		}
		int sum = 0;
		sum = matrix[0][0]+matrix[0][1]+matrix[0][2]+matrix[0][3];
		sum = sum+matrix[1][0]+matrix[1][1]+matrix[1][2]+matrix[1][3];
		sum = sum+matrix[2][0]+matrix[2][1]+matrix[2][2]+matrix[2][3];
		sum = sum+matrix[3][0]+matrix[3][1]+matrix[3][2]+matrix[3][3];
		System.out.print("The total is "+sum+".");
			
	}

}

(1) You may define the method as the main(). Hence replace the line 8 with

public static void main(String args[] ){

(2) You forgot to create the instance of Scanner: input. Hence insert line 8 the following code:

Scanner input=new Scanner(System.in);

It works. Attached please find the mofidied program.

Attachments
import java.util.Scanner;
public class sumMatrix1 {
	/**
	 * @param args 
	 */
	public static void main(String args[]){
		Scanner input = new Scanner(System.in);
		// TODO Auto-generated method stub
		int matrix[][] = new int[4][4];
		System.out.print("Enter the first row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[0][i] = (int) input.nextDouble();
		} 
		System.out.print("Enter the second row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[1][i] = (int) input.nextDouble();
		}
		System.out.print("Enter the third row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[2][i] = (int) input.nextDouble();
		}
		System.out.print("Enter the fourth row (four points)of the matrix:" );
		for (int i = 0; i < matrix.length; i++){
			matrix[3][i] = (int) input.nextDouble();
		}
		int sum = 0;
		sum = matrix[0][0]+matrix[0][1]+matrix[0][2]+matrix[0][3];
		sum = sum+matrix[1][0]+matrix[1][1]+matrix[1][2]+matrix[1][3];
		sum = sum+matrix[2][0]+matrix[2][1]+matrix[2][2]+matrix[2][3];
		sum = sum+matrix[3][0]+matrix[3][1]+matrix[3][2]+matrix[3][3];
		System.out.print("The total is "+sum+".");			
	}
}

Thank you for your patience. Yours works perfectly. I don't know why it is rejecting my edits, but I suspect user error.

This question has already been answered. Start a new discussion instead.