File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized and abstract

 
ganesh subbiah
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a doubt why synchronized modifier be used along with abstract modifier with a method .


Thanx in Advance
Ganesh S
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your question is not clear!!
 
Olivier Lambert
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't define a method both abstract and synchronized. Abstract implies that your method has no body while synchronized says that the body of your method is "secured" ...
 
Mike Gershman
Ranch Hand
Posts: 1272
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't use other modifiers besides public, protected, and private with abstract because they are implementation details, not client interface specifications.

What if a better implementation of your method used individual synchronized blocks of code or you found a thread-safe algorithm that didn't need locks at all? Why force the entire method to be synchronized by inheritance?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
take up a dictionary and look up the meaning of the words 'doubt' and 'question'.

doubt != question, therefore your statement does not compile.
It caused a compiler error in my brain of which this is the output so I am unable to help you further.

Stack overflow, nullpointer out of range error, reset universe.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic