List<String> op= new ArrayList<String>();
op.add("AA");
op.add("BB");
op.add("CC");
Data[] aData = new Data[100];
for(int i = 0 ;i<100;i++) {
String currentString = op.get(rand.nextInt(3));
System.out.println("> " + currentString );
aData[i].setOp(currentOperator); // line number 29
}
This above code is giving below mentioned error
Note: setOp() is setter present in class Data
Error:
> AA
Exception in thread "main" java.lang.NullPointerException
at com.Learn.Calculation.Test.main(Test.java:29)
Why is this error coming when I can see the value of currentString is AA