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
The most common use of ___________ in OOP occurs when a parent class reference is used to refer to a child class object.
polymorphism
Any Java object that can pass more than one IS-A test is considered to be __________
polymorphic
If a class has multiple methods having same name but different in parameters, it is known as ______ _________
Method Overloading
If we have to perform only one operation, having same name of the methods _________ the ___________ of the program.
If we have to perform only one operation, having same name of the methods increases the readability of the program.
What are the two ways to overload the method in java?
- By changing number of arguments
- By changing the data type
class Adder{
static int add(int a, int b){return a+b;} // 2 arguments
static int add(int a, int b, int c){return a+b+c;} //3 arguments
}
Method overloading is not possible by changing the return type of the method.
True or False
True
If subclass (child class) has the same method as declared in the parent class, it is known as _____ ________ in Java
method overriding
______ overriding is used to provide the specific implementation of a method which is already provided by its superclass.
- Method overriding is used to provide the specific implementation of a method which is already provided by its superclass.
_______ overriding is used for runtime polymorphism
Method overriding is used for runtime polymorphism

