Java OOP’s Concepts
By
Dr. Vipin Kumar
What is OOP’s
• OOP’s is the modern programming approach to
replace the older procedural or structural
programming approach. It is object based
programming approach to solve real life business
oriented problems.
• Its includes following techniques.
– Class
– Object
– Inheritance
– Polymorphism
– Abstraction
– Encapsulation
Class
• Class is a blueprint of an object.
• Class describes object properties and behavior.
Object
• Object is an instance of class
• Object is the variable of user define data type class
Inheritance
• It is the technique in OOP by which we make a new class based
on existing class, new class extending the existing class and
inheriting the existing class attributes and methods.
• Existing class = super class/parent class
• New class = sub class/child class
Types of Inheritance
• Simple Inheritance
• Multi-Level Inheritance
Types of Inheritance
• Multiple Inheritance
• Hierarchical Inheritance
Types of Inheritance
• Hybrid Inheritance
Polymorphism
• It is the combination of two word poly + morph
Poly = many Morph = form
• It is the technique in OOP that refer to the ability of an object
to have many form.
• Ability of an object to behave differently
• It is two type:
– Run Time: Method Overriding
– Compile Time: Method Overloading
Encapsulation
• It is the technique in OOP by which we declare private attributes in a
class and access those attributes by using public method.
• All attributes are hiding from client access and only access and
modified by using getter and setter method.
• Attributes can only be access or read by getter method and can only
be written by setter method of that attribute.
• It hides the data from external world. It protects the data within
class, and exposes methods to the world.
Abstraction
• Abstraction is one of the core Object-Oriented Programming (OOP)
principles that focuses on hiding internal implementation and
highlights only necessary information that is required.
• In another way, we can say, It is the technique in OOP that refer to
the ability of an object to show only necessary information of an
object to the client.
• It hides the internal implementation, and creates the skeleton of
what is required for that Entity.
• We can achieve Abstraction by Two Ways:
– Abstract Class (0 % to 100 %)
– Interface (100%)