Originally posted by Mateus Brum:
Why M-LIC can access a final marked variable and not a simple variable?
If the problem is the life cycle of the local variable - the variable die with the stack of method -, why a final don�t die ?
M-LIC? Please don't make up acronyms. It makes your question harder to understand. And I am assuming that you want people to actually understand your question, right?
As for your question, it is just how it is specified.
Java will make a copy of the local variable for the inner class, but the inner class doesn't know that it is a copy. This way, it is no longer tied to the scope of the method.
But, for it to work, the spec requires that the original value doesn't change -- meaning that it is final.
Henry