*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question on Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question on "Final" modifier." Watch "Question on "Final" modifier." New topic
Author

Question on "Final" modifier.

Sanjeev BhimaRao
Ranch Hand

Joined: Jul 17, 2006
Posts: 71
Hi,
Is it possible in any scenario to manipulate or change the value of a variable marked "final" ? I believe it is not possible. Please let me know if someone knows about a possible scenario where this might be possible.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

No it's not possible.


[My Blog]
All roads lead to JavaRanch
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Originally posted by Sanjeev BA:
Hi,
Is it possible in any scenario to manipulate or change the value of a variable marked "final" ? I believe it is not possible. Please let me know if someone knows about a possible scenario where this might be possible.


Ofcourse you cann't change the reference of final variables. But you can change the value of a final Object. like this.



Hope it helps you.


The Best way to predict your future is to create it - Every great individual common man
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

And we're back to a discussion on reference/value

So you cannot change the value of a reference, nor the value of a primitive, marked as final. Of course, you can access the content of a reference.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on "Final" modifier.