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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!