I get the error:
TestCounter.java:115: variable
counters might not have been
initialized
counters[i] = new Counter(i);
And I can't figure out how to fix it. I know that my class, Counter
, works. Below is my code, if you could have a look at it I would be very happy. This code is wrapped in the main method of a TestCounter
class.
if(success)
{
Counter[] counters;
for(int i=0; i<30; i++)
{
counters[i] = new Counter(i);
System.out.println(counters[i].whatIsCounter());
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…