Matrix.java
    import java.io.*;
    class Matrix {
        private int q[][];
        public Matrix() {
            for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                q[i][j] = Integer.parseInt(System.console().readLine());    
        }
        public Matrix( int a , int b ) {    
            int mat[][] = new int [a][b];
            for(int i=0; i<mat.length; i++) {
                for(int j=0;j<mat[i].length;j++)
                    q[i][j] = Integer.parseInt(System.console().readLine());
            }
        }
         public void show() {
            for(int i=0; i<q.length; i++) {
                for(int j=0;j<q[i].length;j++)
                    System.out.println(q[i][j]+" ");
            }   
        }
    }
UseMatrix.java
class UseMatrix {
    public static void main(String args[]) {
        Matrix m1 = new Matrix();  
        System.out.println("First Matrtix ");
        m1.show();
        Matrix m2 = new Matrix(5,4);
        System.out.println("Second Matrtix "); 
        m2.show();
    }
}
This programs shows NullPointerException error at runtime
Confused why this isn't working could use a little help, I want to the create a 2D Array of Size 3*3 through Default Constructors.
Then I want to create a Array of size 5*4 using parameterized constructors.
 
    
