Looks like no one added any tags here yet for you.
Extend
This keyword extends a class (indicates that a class is inherited from another class).
Only one superclass can be extended by a class.
Inheritance
In Java, it is possible to inherit attributes and methods from one class to another.
subclass (child) - the class that inherits from another class
superclass (parent) - the class being inherited from
two categories of "inheritance concept"
Single
Multiple
Hierarchical
Hybrid
Types of Inheritance
Single Inheritance
What type of inheritance
Multiple inheritance
What type of inheritance
Hierarchical inheritance
What type of inheritance
Hybrid inheritance
type of inheritance that is not supported In Java
Final
If you don't want other classes to inherit from a class, use the _______ keyword
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.
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.
Polymorphism
It allows us to perform a single action in different ways.
It means many forms (from poly (many) and morphs (forms)).
Compile-time Polymorphism (Static)
Runtime Polymorphism (Dynamic)
Types of Java polymorphism
Compile-Time Polymorphism
This type of polymorphism is achieved by function overloading or operator overloading.
static polymorphism
Compile-Time Polymorphism is also known as ________.
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.
Runtime Polymorphism
It is a process in which a function call to the overridden method is resolved at Runtime.
Dynamic Method Dispatch
Runtime Polymorphism is also known as ____.
Method Overriding.
Runtime Polymorphism is achieved by _______.
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
Abstraction
is a process of hiding the implementation details from the user and showing only the functionality to the user.
abstract classes, methods, and interfaces.
Abstraction can be achieved by using ______.
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.
abstract
The only keyword needed to make a class an abstract
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.
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.
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
Exception
an unwanted event that interrupts the general flow of the program.
Errors.
Exception is also kmnown as _______.
try
This statement allows you to define a block of code to be tested for errors while it is being executed.
catch
This statement allows you to define a block of code to be executed, if an error occurs in the try block.
Finally
This statement lets you execute code, after try...catch, regardless of the result.