Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Synchronize on objects held in non-final variables?

843789Jul 26 2009 — edited Aug 1 2009
[This thread|http://forums.sun.com/thread.jspa?messageID=10775877#10775877] and post got me thinking:
linuxisbest.eric wrote:
I have noticed in my textbook that it creates a String in two ways:
String a = new String("Hello");
and
String a = "Hello";
Which one should I use? Is there any practical difference?
YoungWinston wrote:Pick door number two linux ... unless you plan on synchronizing on it, that is.
Winston
Is it best practice to only synchronize on objects held in final variables?

Edited by: Encephalopathic on Jul 26, 2009 5:46 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2009
Added on Jul 26 2009
15 comments
483 views