I want to define Poly gon Array , so :
private static ArrayList<PolyDefault> basePolyList = new ArrayList<PolyDefault>();
//read the file and store to basePolyList
parser.readBaseFile(filename_1, basePolyList);
//get size of basePolyList
int SizeOfBase = basePolyList.size();
//def Array of polygon
Poly[] p4=new PolyDefault[SizeOfBase];
for(int i=0;i<SizeOfBase;i++)
{
p4[0].add(basePolyList.get(i));
System.out.println("Poly of Base["+i+"]"+" has " +p4[i].getNumPoints()+"\n");
}
but I have this Error : Exception in thread "main" java.lang.NullPointerException ... Thanks to any Help ...
you have to init the objects of the Array:
for(int i=0;i<SizeOfBase;i++)
{
p4[i] = new Poly();
p4[i].add(basePolyList.get(i));
System.out.println("Poly of Base["+i+"]"+" has " +p4[i].getNumPoints()+"\n");
}