Question: public Matrix(int [][] m) { m = matrix; boolean valid = true; for(int r = 1; r < m.length && valid; r++) { if(m[r].length !=
public Matrix(int [][] m) { m = matrix; boolean valid = true; for(int r = 1; r < m.length && valid; r++) { if(m[r].length != m[0].length) valid = false; } if(valid) matrix = m; else matrix = null; }
/// in app class
public static void main(String[] args) { Matrix a = new Matrix(new int [][] {{1,2},{5,3}}); Matrix b = new Matrix(new int [][] {{3,2},{4,5}}); I keep getting a null pointer exception, please help
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
