I am trying to implement an inner class within a loop, and have come into an interesting situation. The internal class has methods, however, when I try and access the variable, Netbeans gives me a compiler error and tells me to make the int final.
As the int is a looping variable, it can not be final. I have tried creating new variables and equating them to the looping variable, but this still throws the same error.
Here is the basic syntax (in pseudo-code):
for(int i = 0; i < 10; i++)
{
panels[i].printI(new printI(){System.out.println(i);});
}
Any ideas?