Hi Experts,
I have a problem in my code. When iam assigning a avariable to an array it is showing a NullPointerException .Why it is showing that type of exception. This is my code.
for(int i=0;i<countorder;i++) { noOfLineItemsFullFilled=0; actualShortsupplyItems=0; for(int k=0;k<countorder;k++) { if(Ortemp[i].equals(Or[k])) value=k; } for( int j=0;j<stockcount;j++) { // totallinecount++; //System.out.println("totalcount"+totallinecount); if(oqtymatrix[value][j]!=0 ) { // noOfLineItemsFullFilled=0; if(oqtymatrix[value][j] == FinalAllocation[i][j+1]) { noOfLineItemsFullFilled++; } } //System.out.println("LineFillRtae"+(linefill )); } //System.out.println("total lineItems in an order "+NoofItemsinOrder[value][0]);System.out.println("Countorder"+countorder); linefill = (NoofItemsinOrder[value][1]+noOfLineItemsFullFilled) * 100/NoofItemsinOrder[value][0]; System.out.println("LinefillRate"+BigDecimal.valueOf(linefill)); BigDecimal LFR=BigDecimal.valueOf(linefill); //LineFillRate[value]=LFR; //System.out.println("value"+value); try { LineFillRate[value]=LFR; System.out.println("LinefillRate try"+LineFillRate[value]); } catch(NullPointerException e) { //System.out.println("LinefillRate"+LineFillRate[value]); } }