jim, thank you for your answer to my previous question. i'm confused here as i read " the private method can be overridden by a private, friendly, protected or public method. sb told me in the other site saying "private methods can't be overridden or overloaded since they can not be inherited. who is right here? thank you
I hope i can share my views. A private method is never accessible to the subclass and so, it can not be overridden (if it is instance method) or hidden (if it is a static method). But overloading is possible within the class.
why this program runs without error? Isn't the private void moo () method in the canadianBovine class overriding the one in the super class? i think this is the point i got confused: does that mean that the sub class can have its own private method with the same name as the private method in the super class, however it may not override the super's private method ?
Yes it can have the same name, no it will not override. A private method does not exist outside the class for all intents an purposes. So a sub class can do anything with the signature of the superclass' private method including having one with a different return type. It would be a brand new method unrelated to the 'super' method. [This message has been edited by Tony Alicea (edited February 09, 2000).]
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Paul - "public class CanadianBovine inherits Bovine"? Is that the Colorado dialect of Java? Down here we say "extends". We also don't try to put two public classes in the same file, as they each want the file named after them. (: Diane - technically it's not an override if the base method is private - the child method is considered a separate method with the same name. It looks like an override, I know, but it isn't, because of the way override is defined. It's not that the compiler forbids you to override a private method, rather it's that the compiler will completely ignore the parent private method while it's looking in the child class, so there's nothing you could write in the child class that it would ever consider an "override".
"I'm not back." - Bill Harding, Twister
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: can private method be overriden/overloaded???