Why do we make a copy of final instance variable in a method in Java?
Posted
by PRK
on Stack Overflow
See other posts from Stack Overflow
or by PRK
Published on 2010-06-01T19:01:10Z
Indexed on
2010/06/01
19:03 UTC
Read the original article
Hit count: 126
For instance: private final Object o;
public void doSomething(){
final Object local = this.o; //access methods of local;
}
This practice is followed in lots of java classes (such as ArrayBlockingQueue). What's the benefit of this?
© Stack Overflow or respective owner