I have the following code:
for (int i=0; i<wallMaterialName.size(); i++){
if (Math.abs(calculatedWallUValue - alternativeWallUValue) > 0.01){
if(wallMaterialName.get(i).charAt(0) == 'A'){ //*****ERROR IN HERE*****
PreparedStatement prepStateMat = con.prepareStatement("select * from concretestonefloor where value<? order by value desc limit 1");
prepStateMat.setFloat(1, (Float)wallMaterialLambda.get(i));
ResultSet rsMaterial = prepStateMat.executeQuery();
//...
}
//...
}
}
When I run the code, a "java.lang.NullPointerException" appear. The error comes from this code:
if(wallMaterialName.get(i).charAt(0) == 'A')
I don't know why the arraylist is empty since I have checked that it contains some data. Anybody knows how to solve this problem? Thanks.
wallMaterialName.get(i)isnull.