0% found this document useful (0 votes)
30 views5 pages

Oops

Oops concept

Uploaded by

pandeyaman684
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views5 pages

Oops

Oops concept

Uploaded by

pandeyaman684
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

What is class.?

Class is a collection of data member and method.


Or
Class is a collection of object.

What is object.?
Object is a run time entity. With the help of object we can access the public
data member and method of the class.

What are the OOP concepts?


Abstraction
Encapsulation
Polymorphism
Inheritance

What is abstraction.?
Abstraction in Java is a process of hiding the implementation details from the
user and showing only the functionality to the user.
abstraction is achieved by interfaces and abstract classes. We can achieve
100% abstraction using interfaces.

Abstraction Real-Life Example:


1. Car
2. Remote
3. TV
4. Bike
5. Listening to music using headphones etc

What is Encapsulation.?
Encapsulation is a process of wrapping up data and methods within a single
unit(class) ) is called Encapsulation.

Encapsulation Real-Life Example:


1. Bag
2. Mobile
3. OS etc.
Difference Between Abstraction and Encapsulation
Abstraction Encapsulation

Abstraction in Java is a process of hiding


the implementation details from the Encapsulation is a process of wrapping up
user and showing only the functionality to data and methods within a single
the user. unit(class) ) is called Encapsulation.

Encapsulation solves an issue


It solves an issue at the design level.
at implementation level.

It focuses on the external lookout. It focuses on internal working.

It can be implemented using abstract It can be implemented by using the access


classes and interfaces. modifiers (private, public, protected).

It is the process of containing the


It is the process of gaining information.
information.

In abstraction, we use abstract


We use the getters and setters methods
classes and interfaces to hide the code
to hide the data.
complexities.

The objects are encapsulated that helps The object need not to abstract that
to perform abstraction. result in encapsulation.
What is polymorphism.?
Polymorphism is considered one of the important features of Object-Oriented
Programming.
Polymorphism allows us to perform a single action in different ways.
In other words, polymorphism allows you to define one interface and have
multiple implementations.

Types of Java Polymorphism


In Java Polymorphism is mainly divided into two types:

 Compile-time Polymorphism
 Runtime Polymorphism

Compile-Time Polymorphism in Java

It is also known as static polymorphism. This type of polymorphism is


achieved by function overloading or operator overloading.

Note: But Java doesn’t support the Operator Overloading.


Runtime Polymorphism in Java:
It is also known as Dynamic Method Dispatch. This type of polymorphism is
achieved by Method Overriding.

Real-Life Example of Polymorphism:


1. Person (A person can have different
characteristics at the same time. Like a man at
the same time is a father, a husband, and an
employee)
2. Animals' sounds (Different animals make
different sounds, even though people have the
same sound)
3. Boy(This boy can be a student, a player) etc.
What is Inheritance.?
base class is inherited by sub-class is known as inheritance.
Or
Inheritance is an object-oriented programming concept in which one class
acquires the properties and behaviour of another class.

Real-Life example of Inheritance: Vehicle(Car, Bus, Trcuk, Bike etc.)

Types of Inheritance
Java supports the following four types of inheritance:

o Single Inheritance
o Multi-level Inheritance
o Hierarchical Inheritance
o Hybrid Inheritance

Note: Multiple inheritance is not supported in Java.

You might also like