Module 11 Flashcards
(11 cards)
A concept in object-oriented programming that allows objects of different classes to be used interchangeably, while still maintaining their own unique behavior.
Polymorphism
Means “many”
Poly
Means “Take different forms”
Morph
Also known as compile-time polymorphism, refers to the ability of the compiler to determine which method to call at compile time based on the arguments passed to the method.
Achieved through method overloading, where multiple methods in the same class have the same name but different parameters.
Static polymorphism
Also known as runtime polymorphism, refers to the ability of objects to respond to the same message with the appropriate method based on their class definition at runtime.
Achieved through method overriding, where a subclass provides a different implementation of a method that is already defined in its superclass.
Dynamic polymorphism
Allows to use many methods with the same name but differing signatures and return types.
Compile Time
Associated with different classes, but it allows to use the same method with different signature names.
Runtime
The process of associating a method or function call with its implementation at runtime.
Binding
There are two types of binding in Java:
Static binding and Dynamic binding
Occurs when the method to be called is determined at compile time.
This binding is also known as early binding because it takes place before the program actually runs.
Static Binding
Also known as late binding or runtime binding, occurs when the method to be called is determined at runtime.
Dynamic binding is also called late binding or runtime binding because binding occurs during runtime.
Dynamic Binding