Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doubt on synchronized block-3

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
the general form of synchronized block is
----------------------------------------------------------
In the above code,i wrote synchronized(obj).Here obj means object of table class or it may be object of a string class or object of Integer class or it may be any object of any class.
If we write this in place of obj it means it is object of table class.That means we are geting lock on table class.
In below programme I got lock on table class by putting this in place of obj.
But I am not able to write a programme to get lock on object of other than table class.
I want a programme which gets lock on object other than table class.
can any one give such type of programme?
you no need to write entire programme.you simply edit below programme.
-----------------------------------------------------------------------------------------------------------------------------------------------

 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Starting another topic to ask the same question again is a bit inefficient isn't it? Would it not be easier to simply follow up on your previous topic?

https://coderanch.com/t/599436/threads/java/synchronized-block-java

Henry
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic