SlideShare a Scribd company logo
Object Oriented Programming
Chapter 1: Introduction to OOP
Prepared by: Mahmoud Rafeek Alfarra
2016
Salamo 3likom!
I am Mahmoud R. Alfarra
I am here because I love to give knowledge.
Note: I have prepared this material Based on (Liang: “Introduction to Programming using Java”, 10’th edition, 2015)
Outlines
◉ What is Object-Oriented Programming ?
◉ Procedural vs. Object-Oriented Programming
◉ OO Programming Concepts
◉ Concept of Objects and classes
◉ UML Class Diagram
◉ Visibility Modifiers and Accessor Methods
◉ Full Example
‫قال‬ ، ‫عنه‬ ‫اهلل‬ ‫رضي‬ ‫اخلطاب‬ ‫بن‬ ‫عمر‬ ‫عن‬:‫مسعت‬
‫يقول‬ ‫وسلم‬ ‫عليه‬ ‫اهلل‬ ‫صلى‬ ‫اهلل‬ ‫رسول‬:
(،‫نوى‬ ‫ما‬ ‫امريء‬ ‫لكل‬ ‫وإمنا‬ ، ‫ّات‬‫ي‬‫بالن‬ ‫األعمال‬ ‫إمنا‬
‫إىل‬ ‫فهجرته‬ ، ‫ورسوله‬ ‫اهلل‬ ‫إىل‬ ‫هجرته‬ ‫كانت‬ ‫فمن‬
‫أو‬ ، ‫يصيبها‬ ‫لدنيا‬ ‫هجرته‬ ‫كانت‬ ‫ومن‬ ، ‫ورسوله‬ ‫اهلل‬
‫إليه‬ ‫هاجر‬ ‫ما‬ ‫إىل‬ ‫فهجرته‬ ، ‫ينكحها‬ ‫امرأة‬)
‫صحيحهما‬ ‫يف‬ ‫ومسلم‬ ‫البخاري‬ ‫رواه‬
‫وال‬ ‫ستقيم‬ ‫ت‬ ‫وال‬ ‫لو‬ ‫حت‬ ‫ال‬ ‫ياة‬ ‫احل‬
‫عاىل‬ ‫ت‬ ‫اهلل‬ ‫عة‬ ‫بطا‬ ‫إال‬ ‫سهل‬ ‫ت‬
‫ليت‬ ‫ا‬ ‫خالق‬ ‫واأل‬ ‫باآلداب‬ ‫تأدب‬ ‫وال‬
‫شريعته‬ ‫يف‬ ‫لنا‬ ‫وردت‬.
،،، ‫صح‬ ‫عيشها‬
Lecture
Let’s start with the first set of concepts
1
Our Life is a set of
Objects
o To have a fine definition of OOP, Please note what you
are showing in your class room now?
What is OOP?
Chairs
Tables
Teacher
PCs
.
.
# of legs
Type of material
Color
.
.
.
o Object-oriented programming (OOP) involves programming using
objects.
o An object represents an entity in the real world that can be
distinctly identified.
o For example, a student, a desk, a circle, a button, and even a loan
can all be viewed as objects.
o An object has a unique identity, state, and behaviors.
What is OOP?
o The unit in procedural programming
is function.
o Procedural programming
concentrates on creating functions.
o Procedural programming separates
the data of the program from the
operations that manipulate the
data.
Procedural vs. Object-Oriented Programming
o The unit in object-oriented
programming is class.
o Object-oriented programming
starts from isolating the classes,
and then look for the methods
inside them.
o Object-oriented programming
focus on both of them.
Concepts of Object-Oriented Programming
o Abstraction is simplifying complex reality by modeling classes
appropriate to the problem.
o Abstraction is mechanism to show only relevant data to the user.
o i.e: The client cares about what functionality a car offers, not
about how that functionality is implemented.
Abstraction
o Encapsulation allows the programmer to group data and the
methods that operate on them together in one place, and to hide
details from the user.
Encapsulation
AccountValue
Name Address
Change Address
withDraw any value
o Encapsulation protects the integrity of an object's data.
o Protects an object from unwanted access by clients.
 A bank app forbids a client to change an Account's balance.
o Allows you to change the class implementation.
o Allows you to constrain objects' state
Benefits of encapsulation
Abstraction Vs encapsulation
o Inheritance: The ability of a new class to be created from an
existing class by extending it.
Inheritance
Student
Colleague
BCs Diploma
School
Primary Secondary
o Polymorphism enables us to "program in the general" rather than
"program in the specific.
Polymorphism
Practices
Group 1
Compare between
the main concepts of
OOP.
Group 2
Detect 5 objects from
our classroom
Group 3
Diffrenciate between
abstraction and
encabsulation.
Group 4
Diffrenciate between
procedural and Object-
Oriented Programming
Group 5
Give us 3 examples for
inheritance from your
life.
Group 6
Summerize the first
lecture using 1
complext chart.
THANKS!
Any questions?
You can find me at:
Fb/mahmoudRAlfarra
Staff.cst.ps/mfarra
Youtube.com/mralfarra1
@mralfarra
Ad

More Related Content

What's hot (20)

Method overloading
Method overloadingMethod overloading
Method overloading
Lovely Professional University
 
Java object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - BrainsmartlabsJava object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - Brainsmartlabs
brainsmartlabsedu
 
Inter Thread Communicationn.pptx
Inter Thread Communicationn.pptxInter Thread Communicationn.pptx
Inter Thread Communicationn.pptx
SelvakumarNSNS
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
Madishetty Prathibha
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
Farooq Baloch
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
Raja Sekhar
 
JAVA Literals
JAVA LiteralsJAVA Literals
JAVA Literals
ASHUTOSH TRIVEDI
 
Java Arrays
Java ArraysJava Arrays
Java Arrays
Jussi Pohjolainen
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
imypraz
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
SIVASHANKARIRAJAN
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
parag
 
OOP java
OOP javaOOP java
OOP java
xball977
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
javathreads
javathreadsjavathreads
javathreads
Arjun Shanka
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
Ravi_Kant_Sahu
 
Packages in java
Packages in javaPackages in java
Packages in java
Elizabeth alexander
 
Important features of java
Important features of javaImportant features of java
Important features of java
AL- AMIN
 
Java variable types
Java variable typesJava variable types
Java variable types
Soba Arjun
 
Java object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - BrainsmartlabsJava object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - Brainsmartlabs
brainsmartlabsedu
 
Inter Thread Communicationn.pptx
Inter Thread Communicationn.pptxInter Thread Communicationn.pptx
Inter Thread Communicationn.pptx
SelvakumarNSNS
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
Farooq Baloch
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
imypraz
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
parag
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
Important features of java
Important features of javaImportant features of java
Important features of java
AL- AMIN
 
Java variable types
Java variable typesJava variable types
Java variable types
Soba Arjun
 

Viewers also liked (20)

‫‫Chapter4 Polymorphism
‫‫Chapter4 Polymorphism‫‫Chapter4 Polymorphism
‫‫Chapter4 Polymorphism
Mahmoud Alfarra
 
Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
Mahmoud Alfarra
 
Chapter2 array of objects
Chapter2 array of objectsChapter2 array of objects
Chapter2 array of objects
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - مصفوفة الكائنات
البرمجة الهدفية  بلغة جافا - مصفوفة الكائناتالبرمجة الهدفية  بلغة جافا - مصفوفة الكائنات
البرمجة الهدفية بلغة جافا - مصفوفة الكائنات
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكالالبرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكال
Mahmoud Alfarra
 
Design final
Design finalDesign final
Design final
Indu Sharma Bhardwaj
 
البرمجة الهدفية بلغة جافا - مقدمة
البرمجة الهدفية بلغة جافا - مقدمةالبرمجة الهدفية بلغة جافا - مقدمة
البرمجة الهدفية بلغة جافا - مقدمة
Mahmoud Alfarra
 
Lecture 17 design concepts (2)
Lecture 17   design concepts (2)Lecture 17   design concepts (2)
Lecture 17 design concepts (2)
IIUI
 
Java Basics
Java BasicsJava Basics
Java Basics
Dhanunjai Bandlamudi
 
Oop Presentation
Oop PresentationOop Presentation
Oop Presentation
Ghaffar Khan
 
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentChapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Eduardo Bergavera
 
‫Chapter3 inheritance
‫Chapter3 inheritance‫Chapter3 inheritance
‫Chapter3 inheritance
Mahmoud Alfarra
 
Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programming
Haris Bin Zahid
 
Graphs data Structure
Graphs data StructureGraphs data Structure
Graphs data Structure
Mahmoud Alfarra
 
Document clustering and classification
Document clustering and classification Document clustering and classification
Document clustering and classification
Mahmoud Alfarra
 
Java Basics
Java BasicsJava Basics
Java Basics
shivamgarg_nitj
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
Nilesh Dalvi
 
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Michael Redlich
 
Computer Programming- Lecture 4
Computer Programming- Lecture 4Computer Programming- Lecture 4
Computer Programming- Lecture 4
Dr. Md. Shohel Sayeed
 
‫‫Chapter4 Polymorphism
‫‫Chapter4 Polymorphism‫‫Chapter4 Polymorphism
‫‫Chapter4 Polymorphism
Mahmoud Alfarra
 
Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
Mahmoud Alfarra
 
Chapter2 array of objects
Chapter2 array of objectsChapter2 array of objects
Chapter2 array of objects
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - مصفوفة الكائنات
البرمجة الهدفية  بلغة جافا - مصفوفة الكائناتالبرمجة الهدفية  بلغة جافا - مصفوفة الكائنات
البرمجة الهدفية بلغة جافا - مصفوفة الكائنات
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكالالبرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكال
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - مقدمة
البرمجة الهدفية بلغة جافا - مقدمةالبرمجة الهدفية بلغة جافا - مقدمة
البرمجة الهدفية بلغة جافا - مقدمة
Mahmoud Alfarra
 
Lecture 17 design concepts (2)
Lecture 17   design concepts (2)Lecture 17   design concepts (2)
Lecture 17 design concepts (2)
IIUI
 
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentChapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Eduardo Bergavera
 
Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programming
Haris Bin Zahid
 
Document clustering and classification
Document clustering and classification Document clustering and classification
Document clustering and classification
Mahmoud Alfarra
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
Nilesh Dalvi
 
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Michael Redlich
 
Ad

Similar to Object Oriented Programming in Java _lecture 1 (20)

Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
Rajanarayanan subramanian
 
CS3391 OOP UT-I T1 OVERVIEW OF OOP
CS3391 OOP UT-I T1 OVERVIEW OF OOPCS3391 OOP UT-I T1 OVERVIEW OF OOP
CS3391 OOP UT-I T1 OVERVIEW OF OOP
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
BalamuruganV28
 
oops.pdf
oops.pdfoops.pdf
oops.pdf
AnirudhReddy659342
 
Oop lec 2
Oop lec 2Oop lec 2
Oop lec 2
Anwar Ul Haq
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Muhammad Jahanzaib
 
OOP Java
OOP JavaOOP Java
OOP Java
Saif Kassim
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
Atikur Rahman
 
Object oriented design-UNIT V
Object oriented design-UNIT VObject oriented design-UNIT V
Object oriented design-UNIT V
Azhar Shaik
 
Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...
Alain Lompo
 
Oop's
Oop'sOop's
Oop's
JatinSaini84
 
OOPs-Interview-Questions.pdf
OOPs-Interview-Questions.pdfOOPs-Interview-Questions.pdf
OOPs-Interview-Questions.pdf
Samir P.
 
Oop.pptx
Oop.pptxOop.pptx
Oop.pptx
KalGetachew2
 
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdfSulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
SULTHAN BASHA
 
Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)
Nuzhat Memon
 
Twins: OOP and FP
Twins: OOP and FPTwins: OOP and FP
Twins: OOP and FP
RichardWarburton
 
Question Pattern in Object Oriented Programming
Question Pattern in Object Oriented ProgrammingQuestion Pattern in Object Oriented Programming
Question Pattern in Object Oriented Programming
Suman Mia
 
Using at least two examples (whenever applicable), concisely discuss .pdf
Using at least two examples (whenever applicable), concisely discuss .pdfUsing at least two examples (whenever applicable), concisely discuss .pdf
Using at least two examples (whenever applicable), concisely discuss .pdf
rajeshjangid1865
 
Something for Nothing
Something for NothingSomething for Nothing
Something for Nothing
Kevlin Henney
 
Object Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshopObject Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshop
Mohammad Shawahneh
 
Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
BalamuruganV28
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
Atikur Rahman
 
Object oriented design-UNIT V
Object oriented design-UNIT VObject oriented design-UNIT V
Object oriented design-UNIT V
Azhar Shaik
 
Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...
Alain Lompo
 
OOPs-Interview-Questions.pdf
OOPs-Interview-Questions.pdfOOPs-Interview-Questions.pdf
OOPs-Interview-Questions.pdf
Samir P.
 
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdfSulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
SULTHAN BASHA
 
Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)
Nuzhat Memon
 
Question Pattern in Object Oriented Programming
Question Pattern in Object Oriented ProgrammingQuestion Pattern in Object Oriented Programming
Question Pattern in Object Oriented Programming
Suman Mia
 
Using at least two examples (whenever applicable), concisely discuss .pdf
Using at least two examples (whenever applicable), concisely discuss .pdfUsing at least two examples (whenever applicable), concisely discuss .pdf
Using at least two examples (whenever applicable), concisely discuss .pdf
rajeshjangid1865
 
Something for Nothing
Something for NothingSomething for Nothing
Something for Nothing
Kevlin Henney
 
Object Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshopObject Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshop
Mohammad Shawahneh
 
Ad

More from Mahmoud Alfarra (20)

Computer Programming, Loops using Java - part 2
Computer Programming, Loops using Java - part 2Computer Programming, Loops using Java - part 2
Computer Programming, Loops using Java - part 2
Mahmoud Alfarra
 
Computer Programming, Loops using Java
Computer Programming, Loops using JavaComputer Programming, Loops using Java
Computer Programming, Loops using Java
Mahmoud Alfarra
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structure
Mahmoud Alfarra
 
Chapter9 graph data structure
Chapter9  graph data structureChapter9  graph data structure
Chapter9 graph data structure
Mahmoud Alfarra
 
Chapter 8: tree data structure
Chapter 8:  tree data structureChapter 8:  tree data structure
Chapter 8: tree data structure
Mahmoud Alfarra
 
Chapter 7: Queue data structure
Chapter 7:  Queue data structureChapter 7:  Queue data structure
Chapter 7: Queue data structure
Mahmoud Alfarra
 
Chapter 6: stack data structure
Chapter 6:  stack data structureChapter 6:  stack data structure
Chapter 6: stack data structure
Mahmoud Alfarra
 
Chapter 5: linked list data structure
Chapter 5: linked list data structureChapter 5: linked list data structure
Chapter 5: linked list data structure
Mahmoud Alfarra
 
Chapter 4: basic search algorithms data structure
Chapter 4: basic search algorithms data structureChapter 4: basic search algorithms data structure
Chapter 4: basic search algorithms data structure
Mahmoud Alfarra
 
Chapter 3: basic sorting algorithms data structure
Chapter 3: basic sorting algorithms data structureChapter 3: basic sorting algorithms data structure
Chapter 3: basic sorting algorithms data structure
Mahmoud Alfarra
 
Chapter 2: array and array list data structure
Chapter 2: array and array list  data structureChapter 2: array and array list  data structure
Chapter 2: array and array list data structure
Mahmoud Alfarra
 
Chapter1 intro toprincipleofc#_datastructure_b_cs
Chapter1  intro toprincipleofc#_datastructure_b_csChapter1  intro toprincipleofc#_datastructure_b_cs
Chapter1 intro toprincipleofc#_datastructure_b_cs
Mahmoud Alfarra
 
Chapter 0: introduction to data structure
Chapter 0: introduction to data structureChapter 0: introduction to data structure
Chapter 0: introduction to data structure
Mahmoud Alfarra
 
3 classification
3  classification3  classification
3 classification
Mahmoud Alfarra
 
8 programming-using-java decision-making practices 20102011
8 programming-using-java decision-making practices 201020118 programming-using-java decision-making practices 20102011
8 programming-using-java decision-making practices 20102011
Mahmoud Alfarra
 
7 programming-using-java decision-making220102011
7 programming-using-java decision-making2201020117 programming-using-java decision-making220102011
7 programming-using-java decision-making220102011
Mahmoud Alfarra
 
6 programming-using-java decision-making20102011-
6 programming-using-java decision-making20102011-6 programming-using-java decision-making20102011-
6 programming-using-java decision-making20102011-
Mahmoud Alfarra
 
5 programming-using-java intro-tooop20102011
5 programming-using-java intro-tooop201020115 programming-using-java intro-tooop20102011
5 programming-using-java intro-tooop20102011
Mahmoud Alfarra
 
4 programming-using-java intro-tojava20102011
4 programming-using-java intro-tojava201020114 programming-using-java intro-tojava20102011
4 programming-using-java intro-tojava20102011
Mahmoud Alfarra
 
3 programming-using-java introduction-to computer
3 programming-using-java introduction-to computer3 programming-using-java introduction-to computer
3 programming-using-java introduction-to computer
Mahmoud Alfarra
 
Computer Programming, Loops using Java - part 2
Computer Programming, Loops using Java - part 2Computer Programming, Loops using Java - part 2
Computer Programming, Loops using Java - part 2
Mahmoud Alfarra
 
Computer Programming, Loops using Java
Computer Programming, Loops using JavaComputer Programming, Loops using Java
Computer Programming, Loops using Java
Mahmoud Alfarra
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structure
Mahmoud Alfarra
 
Chapter9 graph data structure
Chapter9  graph data structureChapter9  graph data structure
Chapter9 graph data structure
Mahmoud Alfarra
 
Chapter 8: tree data structure
Chapter 8:  tree data structureChapter 8:  tree data structure
Chapter 8: tree data structure
Mahmoud Alfarra
 
Chapter 7: Queue data structure
Chapter 7:  Queue data structureChapter 7:  Queue data structure
Chapter 7: Queue data structure
Mahmoud Alfarra
 
Chapter 6: stack data structure
Chapter 6:  stack data structureChapter 6:  stack data structure
Chapter 6: stack data structure
Mahmoud Alfarra
 
Chapter 5: linked list data structure
Chapter 5: linked list data structureChapter 5: linked list data structure
Chapter 5: linked list data structure
Mahmoud Alfarra
 
Chapter 4: basic search algorithms data structure
Chapter 4: basic search algorithms data structureChapter 4: basic search algorithms data structure
Chapter 4: basic search algorithms data structure
Mahmoud Alfarra
 
Chapter 3: basic sorting algorithms data structure
Chapter 3: basic sorting algorithms data structureChapter 3: basic sorting algorithms data structure
Chapter 3: basic sorting algorithms data structure
Mahmoud Alfarra
 
Chapter 2: array and array list data structure
Chapter 2: array and array list  data structureChapter 2: array and array list  data structure
Chapter 2: array and array list data structure
Mahmoud Alfarra
 
Chapter1 intro toprincipleofc#_datastructure_b_cs
Chapter1  intro toprincipleofc#_datastructure_b_csChapter1  intro toprincipleofc#_datastructure_b_cs
Chapter1 intro toprincipleofc#_datastructure_b_cs
Mahmoud Alfarra
 
Chapter 0: introduction to data structure
Chapter 0: introduction to data structureChapter 0: introduction to data structure
Chapter 0: introduction to data structure
Mahmoud Alfarra
 
8 programming-using-java decision-making practices 20102011
8 programming-using-java decision-making practices 201020118 programming-using-java decision-making practices 20102011
8 programming-using-java decision-making practices 20102011
Mahmoud Alfarra
 
7 programming-using-java decision-making220102011
7 programming-using-java decision-making2201020117 programming-using-java decision-making220102011
7 programming-using-java decision-making220102011
Mahmoud Alfarra
 
6 programming-using-java decision-making20102011-
6 programming-using-java decision-making20102011-6 programming-using-java decision-making20102011-
6 programming-using-java decision-making20102011-
Mahmoud Alfarra
 
5 programming-using-java intro-tooop20102011
5 programming-using-java intro-tooop201020115 programming-using-java intro-tooop20102011
5 programming-using-java intro-tooop20102011
Mahmoud Alfarra
 
4 programming-using-java intro-tojava20102011
4 programming-using-java intro-tojava201020114 programming-using-java intro-tojava20102011
4 programming-using-java intro-tojava20102011
Mahmoud Alfarra
 
3 programming-using-java introduction-to computer
3 programming-using-java introduction-to computer3 programming-using-java introduction-to computer
3 programming-using-java introduction-to computer
Mahmoud Alfarra
 

Recently uploaded (20)

SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
National Information Standards Organization (NISO)
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 

Object Oriented Programming in Java _lecture 1

  • 1. Object Oriented Programming Chapter 1: Introduction to OOP Prepared by: Mahmoud Rafeek Alfarra 2016
  • 2. Salamo 3likom! I am Mahmoud R. Alfarra I am here because I love to give knowledge. Note: I have prepared this material Based on (Liang: “Introduction to Programming using Java”, 10’th edition, 2015)
  • 3. Outlines ◉ What is Object-Oriented Programming ? ◉ Procedural vs. Object-Oriented Programming ◉ OO Programming Concepts ◉ Concept of Objects and classes ◉ UML Class Diagram ◉ Visibility Modifiers and Accessor Methods ◉ Full Example
  • 4. ‫قال‬ ، ‫عنه‬ ‫اهلل‬ ‫رضي‬ ‫اخلطاب‬ ‫بن‬ ‫عمر‬ ‫عن‬:‫مسعت‬ ‫يقول‬ ‫وسلم‬ ‫عليه‬ ‫اهلل‬ ‫صلى‬ ‫اهلل‬ ‫رسول‬: (،‫نوى‬ ‫ما‬ ‫امريء‬ ‫لكل‬ ‫وإمنا‬ ، ‫ّات‬‫ي‬‫بالن‬ ‫األعمال‬ ‫إمنا‬ ‫إىل‬ ‫فهجرته‬ ، ‫ورسوله‬ ‫اهلل‬ ‫إىل‬ ‫هجرته‬ ‫كانت‬ ‫فمن‬ ‫أو‬ ، ‫يصيبها‬ ‫لدنيا‬ ‫هجرته‬ ‫كانت‬ ‫ومن‬ ، ‫ورسوله‬ ‫اهلل‬ ‫إليه‬ ‫هاجر‬ ‫ما‬ ‫إىل‬ ‫فهجرته‬ ، ‫ينكحها‬ ‫امرأة‬) ‫صحيحهما‬ ‫يف‬ ‫ومسلم‬ ‫البخاري‬ ‫رواه‬ ‫وال‬ ‫ستقيم‬ ‫ت‬ ‫وال‬ ‫لو‬ ‫حت‬ ‫ال‬ ‫ياة‬ ‫احل‬ ‫عاىل‬ ‫ت‬ ‫اهلل‬ ‫عة‬ ‫بطا‬ ‫إال‬ ‫سهل‬ ‫ت‬ ‫ليت‬ ‫ا‬ ‫خالق‬ ‫واأل‬ ‫باآلداب‬ ‫تأدب‬ ‫وال‬ ‫شريعته‬ ‫يف‬ ‫لنا‬ ‫وردت‬. ،،، ‫صح‬ ‫عيشها‬
  • 5. Lecture Let’s start with the first set of concepts 1
  • 6. Our Life is a set of Objects
  • 7. o To have a fine definition of OOP, Please note what you are showing in your class room now? What is OOP? Chairs Tables Teacher PCs . . # of legs Type of material Color . . .
  • 8. o Object-oriented programming (OOP) involves programming using objects. o An object represents an entity in the real world that can be distinctly identified. o For example, a student, a desk, a circle, a button, and even a loan can all be viewed as objects. o An object has a unique identity, state, and behaviors. What is OOP?
  • 9. o The unit in procedural programming is function. o Procedural programming concentrates on creating functions. o Procedural programming separates the data of the program from the operations that manipulate the data. Procedural vs. Object-Oriented Programming o The unit in object-oriented programming is class. o Object-oriented programming starts from isolating the classes, and then look for the methods inside them. o Object-oriented programming focus on both of them.
  • 11. o Abstraction is simplifying complex reality by modeling classes appropriate to the problem. o Abstraction is mechanism to show only relevant data to the user. o i.e: The client cares about what functionality a car offers, not about how that functionality is implemented. Abstraction
  • 12. o Encapsulation allows the programmer to group data and the methods that operate on them together in one place, and to hide details from the user. Encapsulation AccountValue Name Address Change Address withDraw any value
  • 13. o Encapsulation protects the integrity of an object's data. o Protects an object from unwanted access by clients.  A bank app forbids a client to change an Account's balance. o Allows you to change the class implementation. o Allows you to constrain objects' state Benefits of encapsulation
  • 15. o Inheritance: The ability of a new class to be created from an existing class by extending it. Inheritance Student Colleague BCs Diploma School Primary Secondary
  • 16. o Polymorphism enables us to "program in the general" rather than "program in the specific. Polymorphism
  • 17. Practices Group 1 Compare between the main concepts of OOP. Group 2 Detect 5 objects from our classroom Group 3 Diffrenciate between abstraction and encabsulation. Group 4 Diffrenciate between procedural and Object- Oriented Programming Group 5 Give us 3 examples for inheritance from your life. Group 6 Summerize the first lecture using 1 complext chart.
  • 18. THANKS! Any questions? You can find me at: Fb/mahmoudRAlfarra Staff.cst.ps/mfarra Youtube.com/mralfarra1 @mralfarra