java新手提问
源代码:
class ImprovedFibonacci{
static final int MAX_INDEX = 9;
public static void main(String[] args){
Two[] that = new Two[10];
that[0].Num = 1;
that[0].mark = false;
that[1].Num = 1;
String marks;
System.out.println("1:"+that[0].Num);
for(int i = 2;i<=MAX_INDEX;i++){
if( that[i-1].Num % 2 == 0 )
{
that[i-1].mark = true;
marks="*";
}
else
{
that[i-1].mark = false;
marks="";
}
System.out.println(i+":"+that[i-1].Num+marks);
that[i].Num = that[i-2].Num + that[i-1].Num;
that[i-1].Num = that[i].Num - that[i-2].Num;
}
}
}
class Two{
public int Num;
public boolean mark;
}
错误信息:
Exception in thread "main" java.lang.NullPointerException
at ImprovedFibonacci.main(ImprovedFibonacci.java:6)
请问错在哪里阿?