COMSCI 2110 - Inheritance, Polymorphism, Abstraction

studied byStudied by 16 people
5.0(1)
get a hint
hint

Extend

1 / 34

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

35 Terms

1

Extend

This keyword extends a class (indicates that a class is inherited from another class).

Only one superclass can be extended by a class.

New cards
2

Inheritance

In Java, it is possible to inherit attributes and methods from one class to another.

New cards
3

subclass (child) - the class that inherits from another class

superclass (parent) - the class being inherited from

two categories of "inheritance concept"

New cards
4

Single

Multiple

Hierarchical

Hybrid

Types of Inheritance

New cards
5

Single Inheritance

What type of inheritance

<p>What type of inheritance</p>
New cards
6

Multiple inheritance

What type of inheritance

<p>What type of inheritance</p>
New cards
7

Hierarchical inheritance

What type of inheritance

<p>What type of inheritance</p>
New cards
8

Hybrid inheritance

type of inheritance that is not supported In Java

New cards
9

Final

If you don't want other classes to inherit from a class, use the _______ keyword

New cards
10

super

keyword is used to access methods of the parent class.

It is used to represent an instance of the parent class which is created implicitly for each object of the child class.

It can be used to invoke the parent class methods and constructors.

It can also be used to access the fields of the parent class.

New cards
11

this

It is used to access methods of the current class.

It is used to represent the current instance of a class.

It is used to access the instance variables and invoke current class methods and constructors. It can be passed as an argument to a method call representing the current class instance.

New cards
12

Polymorphism

It allows us to perform a single action in different ways.

It means many forms (from poly (many) and morphs (forms)).

New cards
13

Compile-time Polymorphism (Static)

Runtime Polymorphism (Dynamic)

Types of Java polymorphism

New cards
14

Compile-Time Polymorphism

This type of polymorphism is achieved by function overloading or operator overloading.

New cards
15

static polymorphism

Compile-Time Polymorphism is also known as ________.

New cards
16
<p>Method Overloading</p>

Method Overloading

When there are multiple functions with the same name but different parameters then these functions are said to be overloaded. Functions can be overloaded by changes in the number of arguments or/and a change in the type of arguments.

New cards
17

Runtime Polymorphism

It is a process in which a function call to the overridden method is resolved at Runtime.

New cards
18

Dynamic Method Dispatch

Runtime Polymorphism is also known as ____.

New cards
19

Method Overriding.

Runtime Polymorphism is achieved by _______.

New cards
20
<p>Method overriding</p>

Method overriding

occurs when a derived class has a definition for one of the member functions of the base class. That base function is said to be overridden.

The function of a superclass/parent class is overwritten by the function of its subclass/child class

New cards
21

Abstraction

is a process of hiding the implementation details from the user and showing only the functionality to the user.

New cards
22

abstract classes, methods, and interfaces.

Abstraction can be achieved by using ______.

New cards
23

Abstract class

a class that cannot be instantiated on its own and is meant to be inherited by concrete classes.

It cannot be declared as final.

New cards
24

abstract

The only keyword needed to make a class an abstract

New cards
25
<p>Abstract method</p>

Abstract method

It is a method declared without an implementation.

It is a method that is declared but not defined in a class. It acts as a placeholder for methods that must be implemented in subclasses.

New cards
26

Interface

They are collections of abstract methods

It is probably the most powerful tools to achieve abstraction in java.

It is completely pure abstract classes.

New cards
27

implements

we use key word ___ in interface, there is no need to use keyword abstract.

We can only extend 1 class, but can implement multiple classes

New cards
28
<p>Exception</p>

Exception

an unwanted event that interrupts the general flow of the program.

New cards
29

Errors.

Exception is also kmnown as _______.

New cards
30

try

This statement allows you to define a block of code to be tested for errors while it is being executed.

New cards
31

catch

This statement allows you to define a block of code to be executed, if an error occurs in the try block.

New cards
32
<p>Finally</p>

Finally

This statement lets you execute code, after try...catch, regardless of the result.

New cards
33
New cards
34
New cards
35
New cards

Explore top notes

note Note
studied byStudied by 21 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 8484 people
Updated ... ago
4.8 Stars(40)
note Note
studied byStudied by 14 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 144 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 45 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 23 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 3852 people
Updated ... ago
4.8 Stars(17)

Explore top flashcards

flashcards Flashcard40 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard147 terms
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard31 terms
studied byStudied by 10 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard64 terms
studied byStudied by 14 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard37 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(4)
flashcards Flashcard160 terms
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard37 terms
studied byStudied by 27 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard51 terms
studied byStudied by 22 people
Updated ... ago
5.0 Stars(1)