Java (1)
Java (1)
and hides the unnecessary information. We can say that the main purpose of
abstraction is data hiding.
example - Like we send msg
# Encaplusation - is use to Binding (or wrapping) code and data together into a
single unit is known as encapsulation.
Example - Capsule
# Coupling in Java
Coupling refers to the relationship between two classes. It indicates the knowledge
one object or class has of another. That means that if one class changes its
properties or behaviour, it will affect the dependent changes in the other class.
Therefore, these changes will depend upon the level of interdependence the two
classes have between them. There are two types of coupling, namely tight coupling,
and loose coupling.
# Inheritance - When one object acquires all the properties and behaviours of
parent object i.e. known as inheritance. It provides code reusability. It is used
to achieve runtime polymorphism.
There are five types of inheritance single, multilevel, multiple, hybrid and
hierarchical.
Example - Scarpio -> car -> Tyre
# Polymorphism - Polymorphism refers to many forms, or it is a process that
performs a single action in different ways. It occurs when we have many classes
related to each other by inheritance.
Example - Person same time Father, Brother, Employee, Husband, Uncle.
# What is Compile-Time Polymorphism in Java?
Compile-Time polymorphism in java is also known as Static Polymorphism. to resolved
at compile-time which is achieved through the Method Overloading.