AnyLogic 6 Discussion

Dear all, I'm trying to construct an array of objects of class StatisticsDiscrete in "parameter variation" additional class code. The usual approach: StatisticsDiscrete[] Stats = new StatisticsDiscrete[1]; Stats[0] = new StatisticsDiscrete(); returns a list of syntax errors. I solved the issue with: StatisticsDiscrete s = new StatisticsDiscrete(); StatisticsDiscrete[] Stats = {s}; The Stats array is then usable in Before/After simulation run parts. I'm just curious why this behaviour...
OK, I found appropriate solution: the second line Stats[0] = new StatisticsDiscrete(); should be put into 'initial experiment setup' part.