| 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: 1803
|
|
|
your question is not clear!!
|
Krishna Srinivasan
OCAJP 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
|
 |
 |
|
|
subject: synchronized and abstract
|
|
|