I am preparing for the SCJP 1.5 exam and have a basic question in one of the topics.
I read that we cannot use the abstract modifier along with the synchronized modifier for a method.
I understand that it won't make any sense to declare a method as both synchronized and abstract as what you put in a synchronized method is specific to the program logic and would not be right to leave the implementation details to the subclass. But apart from this, is there a more fundamental reason why it gives a compile error ?
Thanks in advance, Yogesh.
Yogesh Sawant<br />Keep things simple and not a lot can go wrong.
If overriding method required to make the method synchronized it would make it without breaking overriding rules. IMHO, making abstract method synchronized is meaningless. A method has no body, so for what critical section (data/operation) you are willing to have the method synchronized.
My honeysuckle is blooming this year! Now to fertilize this tiny ad: