• Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronized block vs Synchronization on Object

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class that goes like this:



What happens if I have a final field defined in my class as:



I then can use this lock to synchronize my method3? What would be the difference?
 
Campbell Ritchie
Marshal
Posts: 52519
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that Java® code?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Is that Java® code?


That was Scala! But my question holds irrespective of what the language is (at least ones that run on the JVM)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!