【发布时间】:2011-09-22 15:44:41
【问题描述】:
我有一个公共整数数组,我想在数组中存储 1 或 2,但我收到错误 NullPointerException 我在做什么
public int[] which;
public int gotIt;
public void Check()
{
int cont = 0;
System.out.println(intento[0]);
for(int j = 0;j <= spaces;++j)
{
if(tries[0] == words[numRandom][j])
{
which[gotIt] = j;//im getting the error here
gotIt++;
}
else
{
cont++;
}
}
if(Contador == espacios+1)
{
Errors++;
System.out.println("There was an error");
}
repaint();
}
错误是在我填充被调用的变量时,我不知道为什么会这样,非常感谢
【问题讨论】:
标签: java arrays nullpointerexception