Module 2.3: Polymorphism

0.0(0)
Studied by 2 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

21 Terms

1
New cards

Polymorphism

Means "many forms." It allows objects from different subclasses to be treated collectively using their common superclass type. This makes it possible to write generic code instead of creating separate code for every subclass.

2
New cards

Superclass Type

A general class type that can be used to reference objects belonging to its subclasses.

3
New cards

Polymorphic Reference

A superclass reference variable that refers to a subclass object.

4
New cards

Generic Coding

The practice of writing code that works with multiple related object types through their common superclass. It reduces the need to write separate operations for each subclass.

5
New cards

Shared Method

A method that belongs to a common superclass and can be used by different subclasses. Each subclass may provide its own implementation.

6
New cards

Polymorphic Behavior

The ability of different objects to respond differently when the same method is called.

7
New cards

Method Resolution

The process of determining which method implementation should execute when a method is called.

8
New cards

Method Overriding

Occurs when a subclass provides its own implementation of an inherited method using a compatible method declaration. It allows a subclass to change or specialize the behavior defined by its superclass.

9
New cards

Runtime Method Selection

The process in which Java determines which overridden instance method to execute based on the actual object's class during program execution.

10
New cards

@Override

An annotation placed before a method to indicate that it is intended to override a method inherited from a superclass or declared in an interface. It helps the compiler detect incorrect method declarations.

11
New cards

Method Signature Matching

The requirement that an overriding method must match the inherited method's name and parameter types. If the declaration does not correctly override a method, the compiler can detect the problem when @Override is used.

12
New cards

Compile-Time Checking

The process of checking code for errors before execution. The @Override annotation provides an additional check that helps detect incorrect attempts to override methods.

13
New cards

super.method()

A way to invoke an inherited superclass method from within a subclass. It is useful when an overriding method wants to reuse the original behavior while adding its own operations.

14
New cards

Overridden Method

A superclass method whose behavior has been redefined by a subclass.

15
New cards

Interface

A Java type that defines a contract specifying methods that implementing classes must provide. Presented as collections of method signatures without shared implementations.

16
New cards

Method Contract

A requirement established by an interface that specifies which operations an implementing class must support. The class is responsible for supplying the appropriate implementation.

17
New cards

interface

A Java keyword used to declare an interface.

18
New cards

implements

A Java keyword used when a class agrees to follow the contract defined by an interface.

19
New cards

Multiple Inheritance Through Interfaces

A mechanism that allows a class to inherit multiple interface contracts. Java supports implementing multiple interfaces even though a class can directly extend only one superclass.

20
New cards

Single Class Inheritance

A Java restriction that allows a class to directly extend only one superclass. F

21
New cards

Runnable Interface

A standard Java interface that declares the run() method. It allows classes to define tasks that can be executed by a thread.