SlideShare a Scribd company logo
OBJECT ORIENTED
Hasanka Wijesinghe
PROGRAMMING
MIT, B.Sc
Programming Design Techniques and Programming
Content
Class and Methods
Access Modifiers
Object Oriented Concepts
DSE004 Hasanka Wijesinghe
Java Class and Methods
DSE004 Hasanka Wijesinghe
Java Methods
DSE004 Hasanka Wijesinghe
Method type
Methods with return type
Methods without return type
Methods with return type Methods without return type
Java Object Creation
DSE004 Hasanka Wijesinghe
In Java, objects are instances of classes, and you create objects using the new keyword
along with a constructor.
Class
Object
Access Modifiers
DSE004 Hasanka Wijesinghe
Public
The most permissive access level.
Public members are accessible from any other class.
Access Modifiers
DSE004 Hasanka Wijesinghe
Private
The most restrictive access level.
Private members are only accessible within the same class.
Protected
Members are accessible within the same class, subclass (even if the subclass is in a
different package), and package.
Not accessible outside the package unless there is an inheritance relationship.
Access Modifiers
DSE004 Hasanka Wijesinghe
DSE004 Hasanka Wijesinghe
Object Oriented Programming Concepts
Encapsulation
Encapsulation is the bundling of data and
methods that operate on the data into a
single unit known as a class.
Polymorphism
Polymorphism means "many forms" and
refers to the ability of objects to take on
multiple forms.
Inheritance
Inheritance is a mechanism that allows a
class to inherit properties and behaviors
from another class
Abstraction
Abstraction is the process of simplifying
complex systems by modeling classes based
on the essential properties and behaviors they
possess.
DSE004 Hasanka Wijesinghe
Encapsulation is a way to restrict the direct access to some components of an object
Encapsulation can be used to hide both data members and data functions or
methods associated with an instantiated class or object.
Encapsulation
DSE004 Hasanka Wijesinghe
Consider a class representing a bank account. Apply encapsulation principles to
design the class with private attributes such as account number, balance, and owner's
name. Provide public methods to deposit and withdraw funds while ensuring that the
balance cannot be accessed or modified directly. Demonstrate the usage of
encapsulation in your solution.
Encapsulation
DSE004 Hasanka Wijesinghe
Inheritance is a mechanism that allows a
class (subclass or derived class) to inherit
properties and behaviors from another class
(superclass or base class).
It promotes code reuse and establishes a
relationship between classes, facilitating the
creation of a hierarchical structure.
Inheritance
DSE004 Hasanka Wijesinghe
Inheritance
DSE004 Hasanka Wijesinghe
Super Class / Parent Class
Sub Class / Child Class
In object-oriented programming (OOP), polymorphism is the concept
that an entity in code can have more than one form.
In Java, polymorphism is achieved through method overloading and
method overriding.
Method Overloading: Multiple methods with the same name but
different parameter lists.
Method Overriding: A subclass provides a specific implementation of
a method that is already defined in its superclass.
Polymorphism
DSE004 Hasanka Wijesinghe
Polymorphism
DSE004 Hasanka Wijesinghe
Abstraction involves simplifying complex systems by modeling classes based on the
essential properties and behaviors they possess.
Abstraction can create a clear separation between the interface (what the object does)
and the implementation (how it does it). This separation enhances modularity, making
it easier to maintain and update the system.
It helps break down a large, complex problem into smaller, more manageable
components.
Abstraction
DSE004 Hasanka Wijesinghe
Abstraction
DSE004 Hasanka Wijesinghe
THANK YOU!
DSE004 Hasanka Wijesinghe

More Related Content

PDF
"Study of Java Access Control Mechanism”
PPT
C++Presentation 2.PPT
PPTX
Object Oriented Programming.pptx
PPTX
Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
PPTX
Module1 elementary concepts of objects and classes
PDF
Oops (inheritance&interface)
PPTX
Pi j2.3 objects
"Study of Java Access Control Mechanism”
C++Presentation 2.PPT
Object Oriented Programming.pptx
Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
Module1 elementary concepts of objects and classes
Oops (inheritance&interface)
Pi j2.3 objects

Similar to Object Oriented Programming CONCEPTS.pdf (20)

PPTX
Introduction to OOP concepts
PPTX
Object+oriented+programming+in+java
PPTX
Object oriented programming
PPT
Inheritance, Object Oriented Programming
PPTX
SAD05 - Encapsulation
PPTX
OCA Java SE 8 Exam Chapter 4 Methods Encapsulation
PPT
Chapter 5 (OOP Principles).ppt
PDF
Programming Laboratory Unit 1.pdf
PPT
D2 Object Oriented Programming
PDF
Oops concepts
PPTX
Object Oriented Programming Concepts
PPTX
The Four Pillars of Object-Oriented Programming
PPTX
Module 4 Effect of Reuse on using Encapsulation.pptx
PPTX
OOP presentation.pptx
PPTX
chapter 5 concepts of object oriented programming
PPTX
CPP14 - Encapsulation
PDF
Principles of Object Oriented Programming
PPTX
Java 102 intro to object-oriented programming in java
PPTX
ENCAPSULATION module for IT or comsci.pptx
PPTX
04 Java Language And OOP Part IV
Introduction to OOP concepts
Object+oriented+programming+in+java
Object oriented programming
Inheritance, Object Oriented Programming
SAD05 - Encapsulation
OCA Java SE 8 Exam Chapter 4 Methods Encapsulation
Chapter 5 (OOP Principles).ppt
Programming Laboratory Unit 1.pdf
D2 Object Oriented Programming
Oops concepts
Object Oriented Programming Concepts
The Four Pillars of Object-Oriented Programming
Module 4 Effect of Reuse on using Encapsulation.pptx
OOP presentation.pptx
chapter 5 concepts of object oriented programming
CPP14 - Encapsulation
Principles of Object Oriented Programming
Java 102 intro to object-oriented programming in java
ENCAPSULATION module for IT or comsci.pptx
04 Java Language And OOP Part IV
Ad

More from HasankaNayanjith (6)

PDF
Introduction to computer programming.pdf
PPTX
Introduction to Servers and Server Types.pptx
PPTX
Introduction to Servers - Computer network.pptx
PPTX
APPLICATIONS OF NETWORKS, Computer Network
PPTX
Lec 09 SQL - 3.pptx
PPTX
Lec 07 SQL - 1.pptx
Introduction to computer programming.pdf
Introduction to Servers and Server Types.pptx
Introduction to Servers - Computer network.pptx
APPLICATIONS OF NETWORKS, Computer Network
Lec 09 SQL - 3.pptx
Lec 07 SQL - 1.pptx
Ad

Recently uploaded (20)

PPTX
ai tools demonstartion for schools and inter college
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PPTX
Transform Your Business with a Software ERP System
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
top salesforce developer skills in 2025.pdf
PDF
Digital Strategies for Manufacturing Companies
PPTX
Essential Infomation Tech presentation.pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
ai tools demonstartion for schools and inter college
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Reimagine Home Health with the Power of Agentic AI​
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Odoo Companies in India – Driving Business Transformation.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms I-SECS-1021-03
Nekopoi APK 2025 free lastest update
Transform Your Business with a Software ERP System
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo POS Development Services by CandidRoot Solutions
Internet Downloader Manager (IDM) Crack 6.42 Build 41
top salesforce developer skills in 2025.pdf
Digital Strategies for Manufacturing Companies
Essential Infomation Tech presentation.pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms II-SECS-1021-03

Object Oriented Programming CONCEPTS.pdf

  • 1. OBJECT ORIENTED Hasanka Wijesinghe PROGRAMMING MIT, B.Sc Programming Design Techniques and Programming
  • 2. Content Class and Methods Access Modifiers Object Oriented Concepts DSE004 Hasanka Wijesinghe
  • 3. Java Class and Methods DSE004 Hasanka Wijesinghe
  • 4. Java Methods DSE004 Hasanka Wijesinghe Method type Methods with return type Methods without return type Methods with return type Methods without return type
  • 5. Java Object Creation DSE004 Hasanka Wijesinghe In Java, objects are instances of classes, and you create objects using the new keyword along with a constructor. Class Object
  • 6. Access Modifiers DSE004 Hasanka Wijesinghe Public The most permissive access level. Public members are accessible from any other class.
  • 7. Access Modifiers DSE004 Hasanka Wijesinghe Private The most restrictive access level. Private members are only accessible within the same class.
  • 8. Protected Members are accessible within the same class, subclass (even if the subclass is in a different package), and package. Not accessible outside the package unless there is an inheritance relationship. Access Modifiers DSE004 Hasanka Wijesinghe
  • 10. Object Oriented Programming Concepts Encapsulation Encapsulation is the bundling of data and methods that operate on the data into a single unit known as a class. Polymorphism Polymorphism means "many forms" and refers to the ability of objects to take on multiple forms. Inheritance Inheritance is a mechanism that allows a class to inherit properties and behaviors from another class Abstraction Abstraction is the process of simplifying complex systems by modeling classes based on the essential properties and behaviors they possess. DSE004 Hasanka Wijesinghe
  • 11. Encapsulation is a way to restrict the direct access to some components of an object Encapsulation can be used to hide both data members and data functions or methods associated with an instantiated class or object. Encapsulation DSE004 Hasanka Wijesinghe
  • 12. Consider a class representing a bank account. Apply encapsulation principles to design the class with private attributes such as account number, balance, and owner's name. Provide public methods to deposit and withdraw funds while ensuring that the balance cannot be accessed or modified directly. Demonstrate the usage of encapsulation in your solution. Encapsulation DSE004 Hasanka Wijesinghe
  • 13. Inheritance is a mechanism that allows a class (subclass or derived class) to inherit properties and behaviors from another class (superclass or base class). It promotes code reuse and establishes a relationship between classes, facilitating the creation of a hierarchical structure. Inheritance DSE004 Hasanka Wijesinghe
  • 14. Inheritance DSE004 Hasanka Wijesinghe Super Class / Parent Class Sub Class / Child Class
  • 15. In object-oriented programming (OOP), polymorphism is the concept that an entity in code can have more than one form. In Java, polymorphism is achieved through method overloading and method overriding. Method Overloading: Multiple methods with the same name but different parameter lists. Method Overriding: A subclass provides a specific implementation of a method that is already defined in its superclass. Polymorphism DSE004 Hasanka Wijesinghe
  • 17. Abstraction involves simplifying complex systems by modeling classes based on the essential properties and behaviors they possess. Abstraction can create a clear separation between the interface (what the object does) and the implementation (how it does it). This separation enhances modularity, making it easier to maintain and update the system. It helps break down a large, complex problem into smaller, more manageable components. Abstraction DSE004 Hasanka Wijesinghe