"this.elements" is null error
Hello everyone. I do't know what to do in this situation tbh. I can not find where is the mistake. Can you help me ? public class cMatrix { private long [][] elements; private int row; private int col; /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here cMatrix m1 = new cMatrix(); m1.AssignRandom(); m1.printMatrix(); } public cMatrix(){ row = 10; col = 10; for (int i = 0; i < row; i++){ for (int j = 0; j < col; j++){ } } } public cMatrix(int row, int col){ this.row = row; this.col = col; } public void AssignRandom(){ Random randomNum = new Random(); for (int i = 0; i < row; i++){ for (int j = 0; j < col; j++){ long s; s = randomNum.nextLong(10000); } } } public void printMatrix(){ for (int i = 0; i < row; i++){ for (int j = 0; j < col; j++){ System.out.print(elements[i][j] + " "); } System.out.println(" "); } }