So, I have this class, that contains another class array, and in the constructor I want to make "n" and "nCod" equal 0.
public class ITable
{
TableRow arr[];
class TableRow
{
long n;
int nCod;
ICode cod;
}
ITable()
{
arr = new TableRow[256];
for(int i=0;i<256;i++)
{
arr[i].n = 0;
arr[i].nCod = 0;
}
}
}
When I run it, Eclipse console tells me:
java.lang.NullPointerException
at jhuffman.def.ITable.<init>(ITable.java:21)
That line is:
arr[i].n = 0;