• Post Reply Bookmark Topic Watch Topic
  • New Topic

Every object in Java  RSS feed

 
Phillipe Rodrigues
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me,I'm not getting the below highlighted in bold

Every object in Java has a built-in lockthat only comes into play when the object has synchronized method code.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Phillipe,

in Java you can use every object as a lock for synchronized code because every object has this so-called intrinsic lock. Synchronizing has to be used in multi-threaded applications. But if you're not familiar with multi-threading and synchronized code, it doesn't make much sense to explain this here in short

Marco
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!