aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes synchronized and abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "synchronized and abstract" Watch "synchronized and abstract" New topic
Author

synchronized and abstract

ganesh subbiah
Ranch Hand

Joined: Nov 18, 2004
Posts: 39
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

Joined: Jul 28, 2003
Posts: 1844

your question is not clear!!


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
Olivier Lambert
Greenhorn

Joined: Apr 30, 2004
Posts: 9
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" ...


Oli,<br />SCJP
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
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?


Mike Gershman
SCJP 1.4, SCWCD in process
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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.


42
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: synchronized and abstract