0

This is my code to parse a string which comes in the format of #some headers#val1,val2,val3,val4,val5#. So, i tried to parse the vals out of the format. I'm getting NullPointerException on the last line of the submitted code. Anyone kindly help to resolve this issue

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

Class members DataVals & nCtrlNo defined as

static String[] DataVals;
static String[]  nCtrlNo;
Lucky
  • 16,787
  • 19
  • 117
  • 151
Lingaraj
  • 99
  • 2
  • 13

0 Answers0