OOP CONCEPTS/PRINCIPLE:
Four fundamental concept of OOP are:
Encapsulation, inheritance, polymorphism, and abstraction.
1-Encapsulation:
Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on
the data (methods) together as a single unit. Encapsulation is the process of combining
data and functions into a single unit called class. ... In simpler words, attributes of the class
are kept private and public getter and setter methods are provided to manipulate these
attributes. Thus, encapsulation makes the concept of data hiding possible.
2-Polymorphism:
In programming languages and type theory, polymorphism is the provision of a single
interface to entities of different types or the use of a single symbol to represent multiple
different types. For example, a Shape interface can represent to different entities like
rectangle, triangle and circle etc.
3-Inheritance:
In object-oriented programming, inheritance enables new objects to take on the
properties of existing objects. A class that is used as the basis for inheritance is called a
superclass or base class. A class that inherits from a superclass is called a subclass or
derived class.
4-Abstraction:
Through the process of abstraction, a programmer hides all but the relevant data about an
object in order to reduce complexity and increase efficiency. In other words, necessary
data is displayed and internal details are hide.