In the following example it works and compile by setting the parameter int i
as final
class Miner1
{
Miner getMiner(final int i) {
return new Miner() {
public void perform_work() {
System.out.println(i);
}
};
}
interface Miner { void perform_work(); }
Otherwise if not set to final as the preceding example it won't compile.
Does anybody know why? It should be on scope even without final
as the curly parenthesis are not yet closed.
Thanks in advance.