Polymorphism in object-oriented programming (OOP) allows objects to take on many forms, primarily through method overriding where a subclass can redefine methods of a superclass. In Java, polymorphism is implemented via runtime polymorphism or dynamic method dispatch, meaning the call to an overridden method is resolved at runtime based on the object type rather than the reference type. The document also discusses nested classes, including static and non-static inner classes, and limitations regarding their access to variables and methods of the enclosing class.
Related topics: