.class expected error when compiling
Ive been getting this frustrating error when compiling. My program is essentially supposed to add the values in two matrixes and return a new matrix using the added values
Heres my code:
public Matrix add(Matrix comp)
{
int[][] temp =newint[this.numRows()][this.numCols()];
for (int a = 0; a < comp.numRows(); a++){
for (int b = 0; b < comp.numCols(); b++){
temp[a][b] = this.myCells[a][b] + comp.getVal(a, b);
}
}
Matrix addedMatrix =new Matrix(temp[][]);
return addedMatrix;
}
heres the constructor for Matrix object:
public Matrix(int[][] mat)
{
int[][] myCells =newint[mat.length][mat[0].length];
for (int i = 0; i < mat.length; i++){
for (int j = 0; j < mat[0].length; j++){
myCells[i][j] = mat[i][j];
}
}
}
getVal, numRows, and numCols are all helper methods that just return values.
The error is '.class' expected in the line which says Matrix addedMatrix = new Matrix(temp[][]); I checked for extra brackets but there dont seem to be any.
Any help would be appreciated. Thanks.

