0% found this document useful (0 votes)
56 views

OOP Using Java

This document provides an overview of object-oriented programming concepts including objects, classes, abstraction, encapsulation, and the difference between abstraction and encapsulation. It defines an object as an instance of a class that has state and behavior. It explains that abstraction hides lower-level details and exposes only essential details, and gives an example using an Employee class. Encapsulation is defined as wrapping data and methods together into a single unit (class). It provides an example Person class to illustrate private access modifiers. Finally, it outlines the key differences that abstraction solves design-level problems and is implemented via interfaces/abstract classes, while encapsulation solves implementation problems and uses access modifiers.

Uploaded by

Amrit Singha
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

OOP Using Java

This document provides an overview of object-oriented programming concepts including objects, classes, abstraction, encapsulation, and the difference between abstraction and encapsulation. It defines an object as an instance of a class that has state and behavior. It explains that abstraction hides lower-level details and exposes only essential details, and gives an example using an Employee class. Encapsulation is defined as wrapping data and methods together into a single unit (class). It provides an example Person class to illustrate private access modifiers. Finally, it outlines the key differences that abstraction solves design-level problems and is implemented via interfaces/abstract classes, while encapsulation solves implementation problems and uses access modifiers.

Uploaded by

Amrit Singha
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Department:- ELECTRICAL ENGINEERING

Object_Oriented_Programming

Name:- Amrit Singha


Roll NO:- 27501621058
Semester:- 5Th
Subject Name-:- Object Oriented Programming
Subject Code:- OEEE501
Object Description
 OOP : Object Oriented Programming the Object is the real-time entity having some state
and behavior. In Java, Object is an instance of the class having the instance variables
like the state of the object and the methods as the behavior of the object. The object of a
class can be created by using the new keyword in Java Programming language.
 A class is a template or blueprint from which objects are created. So, an object is the
instance(result) of a class.
 There is various type of object, like.
1. An object is a real-world entity.
2. An object is a runtime entity.
3. The object is an entity which has state and behavior.
4. The object is an instance of a class.
Abstraction
 Abstraction means hiding lower-level details and exposing only the essential and relevant details to the
users
 Example - Employee, Contractor, and FullTimeEmployee Example.
 In this example, we create an abstract Employee class and which contains abstract calculateSalary()
method. Let the subclasses extend Employee class and implement a calculateSalary() method.
 Let's create Contractor and FullTimeEmployee classes as we know that the salary structure for a
contractor and full-time employees are different so let these classes to override and implement a
calculateSalary() method.
Encapsulation
 Encapsulation is a process of wrapping of data and methods in a single unit is called encapsulation.
 In OOP, data and methods operating on that data are combined together to form a single unit, which is
referred to as a Class.
 Consider below Person class diagram, the id and name parameters should not be accessed directly outside
Person class - achieved by private declaration.
Difference between Abstraction and Encapsulation
 Abstraction and Encapsulation in Java are two important Object-oriented programming concept and
they are completely different to each other.
  Encapsulation is a process of binding or wrapping the data and the codes that operate on the data
into a single entity. This keeps the data safe from outside interface and misuse.
  Abstraction is the concept of hiding irrelevant details. In other words, make the complex system
simple by hiding the unnecessary detail from the user.
  Abstraction is implemented in Java using interface and abstract class while Encapsulation is
implemented using private, package-private and protected access modifiers.
  Abstraction solves the problem in the design level. Whereas Encapsulation solves the problem in
the implementation level.
THANK
YOU....
.

You might also like