aspose file tools*
The moose likes Beginning Java and the fly likes clarification regarding one of the rules of overriding given in scjp 6 study guide by Kathy and Bert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

clarification regarding one of the rules of overriding given in scjp 6 study guide by Kathy and Bert

ajithkumar punnakula
Greenhorn

Joined: Dec 27, 2008
Posts: 8
Hi
Did not know if needed to start a new topic or continue an older topic of mine but started a new one.

In the Rules of overriding given in scjp 6 study guide by Kathy and Bert (pg. no. 106)

The rules of overriding a method are as follows:

(5)Instance methods can be overridden only if they are inherited by the subclass.
A subclass withing the same package as the instance's super class can override any superclass method that is not marked private or final.
....
(6)...

http://www.coderanch.com/t/487843/Beginning-Java/java/inheritance-polymorphism-across-packages#2194366
In this post in the case 1 -

The Class C3 does not inherit the method met1() from the Class C1, but it overrides the met1(), since met1() is visible in class C3.

So my Question is that rule - a general rule as mentioned in the book ? as I see a contradicting case above or am I missing something.

Thanks in advance
Ajith
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
Inheritance and the overriding of non-private methods does not
depend on the class packages. So I am confused about how you
see them linked. Can you explain further? Thanks.

Jim ... ...


BEE MBA PMP SCJP-6
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39884
    
  28
You ought to have continued in the old thread, since this appears to be closely related to the old thread. To avoid duplication, I shall close this thread; please continue discussion in the old thread (link in 1st posting), and copy the link to this thread in your replies.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: clarification regarding one of the rules of overriding given in scjp 6 study guide by Kathy and Bert