This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hi, When I was attempting an exam, I came across 2 questions whose mutually contradicting answers have confused me
Question 19. Select three correct statements.
A. A static method may override another static method. B. A static method cannot override a non-static method. C. A non-static method cannot override a static method. D. A non-static method may be overloaded by a static method. E. A synchronized method cannot be overridden.
I gave correct answer as B,C,D.
My concern is regarding the choice A synchronized method cannot be overridden.
Because for the following question
Question 31. Select two correct statements.
A. A static method method can declared abstract. B. A protected method can be overridden to have "default" accessibility (that is, no accessibility modifier). C. A abstract method can be declared private. D. A synchronized method can be overridden by a non-synchronized one. E. A native method can be declared static.
One of the correct answers is D and the explanation given is:
Synchronization is matter of implementation and it is perfectly legal to override a synchronized method to be unsynchronized or the other way around
Can somebody clarify this point?
In what meaning do the two choices in above questions differ, as regards overriding synchronized method?