clickCell[r][c] = false;
및 new LifeGUI(new LifeModel(x, y, s);
에서 NullPointerException이 발생하여 고칠 수 없습니다. 이 문제가 발생하는 이유와 해결 방법에 대해 설명하십시오.왜이 NullPointerException을 수신합니까?
코드 :
public LifeModel(int rows, int cols, int cellSize) {
row = rows;
col = cols;
cSize = cellSize;
for (int r = 0; r < row; r++) {
for (int c = 0; c < col; c++) {
clickCell[r][c] = false;
}
}
}
public static void main(int x, int y, int s) {
new LifeGUI(new LifeModel(x, y, s));
}
clickCell의 유형은 무엇입니까? 어쩌면 방금 할당하지 않은 것 같습니다. – thang