当我将值分配给对象中的 int 数组时,我的代码显示空指针异常:
public class Cage {
int Value;
String Operator;
int[] placeHolders;
}
Cage o = new Cage();
o.Value = Integer.parseInt(strSplit[0]);
o.Operator = strSplit[1];
for(int i=2;i<strSplit.length;i++) {
o.placeHolders[i] = Integer.parseInt(strSplit[i]);
}