File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Help an explanation please 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 "Help an explanation please" Watch "Help an explanation please" New topic

Help an explanation please

Pad Ven
Ranch Hand

Joined: Apr 29, 2005
Posts: 38
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?

Gian Franco
Ranch Hand

Joined: Dec 16, 2003
Posts: 977

In the 1st question the answer "E. A synchronized method cannot be overridden." is not one of the correct answers, so it's not conflicting
with the explanation of the 2nd question.



"Eppur si muove!"
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
REAL QUESTIONS not allowed on this Site!!!

Or is this a mock exam question? If so which mock exam?
[ November 10, 2006: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: Help an explanation please
It's not a secret anymore!