may be overridden... looks vague. Private method is absolutely private for the class that belongs to. What I understand is the signature i.e. valid identifier of a private method can be freely used by any sub class, by doing so the approach differs for accessing a private method of a particular class and really overriding is not taking place here and hiding is happening here. To prevent this we have to use final modifier. Please correct me if my understanding is wrong.
Overriding a method means that by creating a method with the same signature, the method in the parent class is replaced. Thus if a descendent class does not have a method with the same signature the method in the parent class will be called. As a private method is not inherited this definitition cannot be true, thus a private method cannot be overridden, though of course it can be replaced. Marcus ------------------ http://www.jchq.net Mock Exams, FAQ, Tutorial, Links, Book reviews ================================================= Almost as good as JavaRanch =================================================
OK, this is imprecise. Sorry. The point being made is that you can declare methods in subclasses that have identical method names and argument lists. That's not the same as overriding. What happens is more properly likened to overloading. There is no dynamic binding involved, the decision about what method to execute is made statically at compilation time, not at runtime. So, my mistake, I'll be looking to correct this in the next printing. Thanks for pointing it out. Cheers, Simon