Java final keyword – View?


The debate appears to be still raging on if/when the Java final keyword should be be used :(  It reminds me of the OS debate of the 90’s.  What’s your view?

~ by mdavey on May 16, 2012.

2 Responses to “Java final keyword – View?”

  1. I am not Java developer. Isn’t Java keyword ‘final’ to be used to declare runtime read-only fields? Emphasizing its thread-safety characteristic is a bit off target I think.

  2. It’s not a one to one match but I use readonly in.Net as a statement of intent of the lifecycle of a class as much as optimisation for threadsafety. That said I really wish there was a easy mechanism to declare immutably on a class (and enforce it on members) after construction for that very purpose.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: