这是我解析字符串的代码,该字符串的格式为#some headers#val1,val2,val3,val4,val5#。所以,我试图解析格式之外的val。我在提交的代码的最后一行收到NullPointerException。任何人都可以帮助解决这个问题
String stringVal = "formatted text as mentioned above";
System.out.println("In string parser");
String delimit = "#";
int limit = 4;
output = stringVal.split(delimit, limit);
System.out.println("after split : "+ output[2]);
DataVals = output[2].split(",", 6);
System.out.println("DataVals :"+Arrays.toString(DataVals));
nCtrlNo[j] = DataVals[0]; //-----> error occurs on this line
班级成员DataVals& nCtrlNo定义为
static String[] DataVals;
static String[] nCtrlNo;