@Test
public void test() throws IOException{
int a = 5;
Pipe pipe = Pipe.open();
new Thread(new Runnable(){
@Override
public void run() {
pipe.sink();
a++;
}
}).start();
}
why a++
reports an error :
Local variable a defined in an enclosing scope must be final or effectively final
but pipe.sink()
doesn't ?
i'm using jdk8.0