To access a variable in thread you should declare it with final keyword