wood burning stoves 2.0*
The moose likes Mock Exam Errata and the fly likes Rules Roundup #20 (vague wording) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Rules Roundup #20 (vague wording)" Watch "Rules Roundup #20 (vague wording)" New topic
Author

Rules Roundup #20 (vague wording)

Yuri Sforza
Greenhorn

Joined: Apr 15, 2002
Posts: 15
Can a private method of a superclass
be declared within a subclass?

The answer given is YES and explanation says
that "Private methods cannot be overriden,
but they can be re-declared/redefined in the
subclass..."
OK, but the question was about declare,
not about re-declare. For me they are
different terms. I think that method (whether
private or not) may be declared only once
(in the class in question or somewhere higher
in the inheritance hierarchy). When talking
about subclass, what you can do (or try to do)
is re-declaring, overriding, "declaring method
with the same signature as in superclass", ...
but you cannot say that you are "declaring method
of a superclass".
Am I missing something? Comments anybody?

--
Y. Sforza
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
To be 100% JLS compliant the wording should be something like this:
"Can a subclass declare a method that has the same signature than a private method in its superclass?"
Note that the access modifier is NOT part of the signature of a method.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rules Roundup #20 (vague wording)
 
Similar Threads
Overriding question
Overriding doubt ?
private vs. public
private method
Overloading & Overriding