DEVFYI - Developer Resource - FYI

Can a private method of a superclass be declared within a subclass?

Java Interview Questions and Answers (part 1)


(Continued from previous question...)

148. Can a private method of a superclass be declared within a subclass?

Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses. There is no way for private stuff to have a runtime overloading or overriding (polymorphism) features.

(Continued on next question...)

Other Interview Questions