Inheritance Flashcards

1
Q

What is the purpose of the ‘this’ keyword in Java?

A

The this keyword refers to the current instance of the object.

In the case of method overriding, this is used for calling the method of the current class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain the concept of Inheritance?

A

Some objects share certain characteristics and behaviour. By using Inheritance, we can put the common behaviour and characteristics in a base class which is also known as a super class. Inheritance promotes code reuse, method overriding and polymorphism.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of “super” keyword in java?

A

The super keyword refers to the immediate parent class of an object. Using super we can call a method of the parent class from the method of a child class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly