If instance variable is set final its value can not be changed like
public class Final {
private final int b;
Final(int b) {
this.b = b;
As the other answers have specified, you cannot make a final variable refer to another object.
Quoting from the Java Language Specification:
4.12.4. final Variables
A final variable may only be assigned to once... If a final variable holds a reference to an object, then the state of the object may be changed by operations on the object, but the variable will always refer to the same object.
That rule isn't being violated in the edited portion of your question:
You've declared CacheMap as final, and you're not reassigning a new
value to it anywhere. If you'd be able to do that, it would be a
violation.
cachemapdeclaredasfinal only refers to the same thing that CacheMap is
referring to, and is not final itself.
As Suresh has mentioned upthread, it would help if you read up on values and references in Java. A good starting point is this thread: Is Java "pass by reference"?. Make sure you understand why Java is always pass-by-value and never pass-by-reference - that's the reason why the "finalness" of CacheMap wasn't getting passed around.