package com.mycompany.matrix; import com.mycompany.summatrixexception.*; import java.lang.String; import java.lang.StringBuffer; import mycompany.productmatrixexception.*; public class Matrix{ protected int row = 0; protected int column = 0; protected int array[][]; public Matrix (int row, int column){ if(row < 0 || column < 0) throw new RuntimeException("Went beyond the matrix"); this.row = row; this.column = column; if(row < 0 || column < 0) throw new RuntimeException("Went beyond the matrix"); array = new int[row][]; for (int i = 0; i < row; i++){ array[i] = new int[column]; } this.row = row; this.column = column; for (int i = 0; i this.row)||(column > this.row)) throw new RuntimeException("Went beyond the matrix!"); this.array[row][column] = value; } public int getElement(int row, int column){ if((row < 0 || column < 0) && (row > this.row)||(column > this.row)) throw new RuntimeException("Went beyond the matrix!"); return array[row][column]; } public String toString(){ StringBuffer strBuffer = new StringBuffer(); for(int i = 0; i < this.row; i++){ for(int j = 0; j < this.column; j++){ strBuffer.append(this.getElement(i,j)); strBuffer.append(" "); } strBuffer.append("\n"); } return strBuffer.toString(); } public boolean equals ( Object o ) { if(this.hashCode() != o.hashCode()) return false; if ( o instanceof Matrix ) { Matrix a = (Matrix)o; if ((this.row != a.row) ||(this.column != a.column) ) { return false; } for (int i = 0; i