OOP Pillars Flashcards
__________ in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object
Inheritance
The idea behind inheritance in Java is that you can create new classes that are built upon existing _______.
classes
When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also.
True or False
True
___________ means “many forms”, and it occurs when we have many classes that are related to each other by inheritance.
Polymorphism
___________ lets us inherit attributes and methods from another class. ___________ uses those methods to perform different tasks.
Inheritance lets us inherit attributes and methods from another class. Polymorphism uses those methods to perform different tasks.
Inheritance represents the ___ relationship which is also known as a ___________ relationship.
Inheritance represents the IS-A relationship which is also known as a parent-child relationship.
What are the Advantages of Inheritance?
- For Method Overriding (so runtime polymorphism can be achieved).
- For Code Reusability.
____ is a group of objects which have common properties. It is a template or blueprint from which objects are created.
class
________ is a class which inherits the other class. It is also called a derived class, extended class, or child class.
subclass
__________ is the class from where a subclass inherits the features. It is also called a base class or a _____ ____.
Superclass is the class from where a subclass inherits the features. It is also called a base class or a parent class.
________ is a mechanism which facilitates you to reuse the fields and methods of the existing class when you create a new class. You can use the same fields and methods already defined in the previous class.
reusability
The _______ keyword indicates that you are making a new class that derives from an existing class. The meaning of “_______” is to increase the functionality.
class Subclass-name extends Superclass-name
{
//methods and fields added here
}
extends
What are the three types of inheritance in java?
single, multilevel and hierarchical
In java programming, ________ and ______ inheritince is supported through interface only.
In java programming, multiple and hybrid inheritance is supported through interface only.
Is multiple inheritance supported by Java?
No