Module 6 - Polymorphism and Abstract Classes
Polymorphism in Java is a feature that allows objects of different classes to be treated as objects of a common superclass. This means that a variable of the superclass type can refer to an object of any subclass. It enables code reusability and flexibility by using different objects interchangeably. Polymorphism is achieved through method overriding and method overloading in Java.
Abstract classes in Java are classes that cannot be instantiated and are typically used as base classes for other classes. They can contain both abstract and non-abstract methods. Abstract methods are declared without an implementation and must be implemented by any concrete subclass. Abstract classes are denoted by the 'abstract' keyword.
COSC-1437 / ITSE-2457 Computer Science Dept. - Author: Dr. Kevin Roark