怎么返回空指针呢?# Java - 爪哇娇娃
c*t
1 楼
public class myclass
{
private String [] typeId=null;
public myclass(){};
public String [] getTypeId(Res a)
{
int i=0;
for(i=0;i {
if(a[i]!=null)
{
typeId[i]=new String("Levl " + i);
}
}
return typeId;
}
}
调用getTypeId时的a不是空的,但getTypeId返回时出错,说是NullPointerExceptio
{
private String [] typeId=null;
public myclass(){};
public String [] getTypeId(Res a)
{
int i=0;
for(i=0;i
if(a[i]!=null)
{
typeId[i]=new String("Levl " + i);
}
}
return typeId;
}
}
调用getTypeId时的a不是空的,但getTypeId返回时出错,说是NullPointerExceptio