You declare a reference as final and not the actual object. That means, you cannot change the value of the reference (which is an address pointing to the object). So once you declare a reference as final, you cannot reassign it to another object.
So declaring a variable as final is like making it a constant. Note that the object can be modified even if the reference is final. For a final reference to truly act as a constant, the object has to be immutable.
remember, in java, you don't have direct access to objects. In your statement:
final Anyclass obj = new Anyclass();
'obj' is a reference to an object, and the real object is on the heap. the reference tells you how to get there.
You can kind of think of it as an index card that holds an address. Normally, you write the address in pencil. you can erase or change it. when you say "final Anycallss obj", you are writing the address in ink - it cannot be changed or erased.
But just because i have an address written down in ink doesn't mean somebody can't bulldoze the house that lives there and build a different one, or remodel the exisiting house.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com