SlideShare a Scribd company logo
2.1 Introduction to Object-
  Oriented Programming
2.1.1 Procedural versus OOP
            languages
• Procedural programming involves
  creating a sequence of instructions
• OOP uses a collection of
  interacting objects
• Functions are logically grouped,
  making enhancements easy
• OOP can model human problem-
  solving
2.1.2 Basic Java terminology
Object. contains data and instructions
Class. blueprint for an object
Attribute. describe the state of objects
Data Type. describes what kind of information a
  certain attribute is
Behavior. describe what objects can do
Method. a set of instructions
Inheritance. Some objects derive attributes and
  behaviors from other objects
Encapsulation. Combining data and methods
  together
2.2 What are Objects? 2.2.1
       Introduction to objects
• Anything tangible or abstract that is
  relevent
• Objects can have attributes and
  behaviors
• Attributes describe the object
• Behaviors describe what the object
  can do
2.2.2 Classification of objects
• User Interface objects
  – Objects that the user interacts directly
    with
• Operating environment objects
  – Provide services to other components
• Task Related objects
  – Documents, multimedia, problem
    domain
2.2.3 Objects - identifying, defining,
     creating and operating on

• Identifying – Requires needs assessment
• Defining – Classification, relationships,
  operations. The class keyword
• Creating – The constructor and the new
  keyword
• Operating – Using an object’s methods
2.2.7 Encapsulation
• To hide the details, package together
• Access modifiers – public, private
  and protected
2.2.8 Object relationships
• Association
  – Objects know
    about each other
• Whole-part
  – Existance of an
    object relies on
    another
• Inheritance
  – Attributes &
    behaviors can be
    inherited
2.2.9 Inheritance
2.2.10 Object mutability and
             destruction
• Some object attributes should be immutable, or
  unchangable
• To make an item immutable, use the final
  keyword
• The JVM automatically releases memory when
  objects are no longer required
• The garbage collector will reclaim memory by
  objects that are no longer referenced
• Garage collection is not controllable
2.3.1 Modeling languages and
             symbols

• Unified Modeling
  Language (UML)
  standardizes symbols
  & terminology for
  diagramming objects
2.3.2 Basic Class symbol
        • Rectangle represents a class
          of objects
        • 3 compartments: Name,
          attributes , and operations or
          methods
        • Symbols indicate
          accessibility
2.4.1 Class definition
                                      •Defined by using
public class Person {
  private String name;                the class keyword
    public Person(String theName) {   •Public classes
         name = theName;              defined in separate
    }
}                                     files
                                      •Filename must be
                                      the same as the
                                      class name
2.4.2 Creating objects
• Constructor methods are called when an
  object is created
• All object data is stored in memory
• Variables are a reference to the memory
  location
2.4.3 Object methods
•   Mutator – Changes object data
•   Accessor – Retrieves object data
•   Methods with no arguments
•   Methods that require arguments
•   Method return values – Provide a result to
    the caller
2.5.1 System class
• Data stored by an object is member data
• Data present in an object’s methods is
  called local or temporary data
• Java.lang.System is a pre-defined object
  that can be used to perform system tasks


  System.out.println(“Hello World!”);

More Related Content

PDF
Chapter3 bag2
teknik komputer ui
 
PPT
Java Naming & Directory Services
Darryl Sherman
 
PPT
Chap01
Jotham Gadot
 
PPTX
Data classes in kotlin by Naveed
Naveed Ahmad - Google Certified Android Developer ✪
 
PPTX
Java Programming and J2ME: The Basics
tosine
 
PPT
Lukito Edi Nugroho - Object Orientation Concepts
belajarkomputer
 
PPT
Constructors
M Vishnuvardhan Reddy
 
PPT
Jndi
Tulika Singh
 
Chapter3 bag2
teknik komputer ui
 
Java Naming & Directory Services
Darryl Sherman
 
Chap01
Jotham Gadot
 
Java Programming and J2ME: The Basics
tosine
 
Lukito Edi Nugroho - Object Orientation Concepts
belajarkomputer
 
Constructors
M Vishnuvardhan Reddy
 

What's hot (6)

PDF
Java Programming Paradigms Chapter 1
Sakthi Durai
 
PDF
Virtual Enterprise Model
Surendra Kancherla
 
PPTX
Object Oriented Programming Using C++
Muhammad Waqas
 
PDF
International Journal of Engineering and Science Invention (IJESI)
inventionjournals
 
PPTX
Introduction Of Java
Afreen Shaikh
 
PPT
Basic concepts of object oriented programming
Sachin Sharma
 
Java Programming Paradigms Chapter 1
Sakthi Durai
 
Virtual Enterprise Model
Surendra Kancherla
 
Object Oriented Programming Using C++
Muhammad Waqas
 
International Journal of Engineering and Science Invention (IJESI)
inventionjournals
 
Introduction Of Java
Afreen Shaikh
 
Basic concepts of object oriented programming
Sachin Sharma
 
Ad

Viewers also liked (8)

PDF
Modul 4
teknik komputer ui
 
PDF
Modul 1
teknik komputer ui
 
PDF
Modul 3
teknik komputer ui
 
PDF
Modul 1
teknik komputer ui
 
PDF
Modul 5
teknik komputer ui
 
PPTX
Procedural programming
Anbarasan Gangadaran
 
PPT
Introduction to Procedural Programming in C++
Salahaddin University-Erbil
 
PPTX
Procedural programming
Ankit92Chitnavis
 
Procedural programming
Anbarasan Gangadaran
 
Introduction to Procedural Programming in C++
Salahaddin University-Erbil
 
Procedural programming
Ankit92Chitnavis
 
Ad

Similar to Chapter2 bag2 (20)

PPTX
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
PDF
JAVA-PPT'S.pdf
AnmolVerma363503
 
PPTX
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
PPTX
JAVA-PPT'S.pptx
RaazIndia
 
PPT
9 cm604.14
myrajendra
 
PDF
Java pdf
Vinod Panchatcharam
 
PDF
MCA NOTES.pdf
RAJASEKHARV10
 
PPTX
OOPS in Java
Zeeshan Khan
 
PPTX
Android Training (Java Review)
Khaled Anaqwa
 
PDF
2.oop concept
Robbie AkaChopa
 
DOCX
Object Oriented Programming All Unit Notes
BalamuruganV28
 
PDF
M.c.a. (sem iv)- java programming
Praveen Chowdary
 
PPTX
INTRODUCTION TO JAVA
RAMALINGHAM KRISHNAMOORTHY
 
PPTX
Object Oriented Programming
Manish Pandit
 
PPTX
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
AnkurSingh340457
 
PPTX
Ch-2ppt.pptx
ssuser8347a1
 
PPTX
Object Oriented Programming Tutorial.pptx
ethiouniverse
 
PPTX
Intro to object oriented programming.pptx
RafiaZafar19
 
PPT
OO Development 4 - Object Concepts
Randy Connolly
 
DOCX
javaopps concepts
Nikhil Agrawal
 
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
JAVA-PPT'S.pdf
AnmolVerma363503
 
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
RaazIndia
 
9 cm604.14
myrajendra
 
MCA NOTES.pdf
RAJASEKHARV10
 
OOPS in Java
Zeeshan Khan
 
Android Training (Java Review)
Khaled Anaqwa
 
2.oop concept
Robbie AkaChopa
 
Object Oriented Programming All Unit Notes
BalamuruganV28
 
M.c.a. (sem iv)- java programming
Praveen Chowdary
 
INTRODUCTION TO JAVA
RAMALINGHAM KRISHNAMOORTHY
 
Object Oriented Programming
Manish Pandit
 
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
AnkurSingh340457
 
Ch-2ppt.pptx
ssuser8347a1
 
Object Oriented Programming Tutorial.pptx
ethiouniverse
 
Intro to object oriented programming.pptx
RafiaZafar19
 
OO Development 4 - Object Concepts
Randy Connolly
 
javaopps concepts
Nikhil Agrawal
 

More from teknik komputer ui (20)

PDF
Modul 2
teknik komputer ui
 
PDF
The cisco networking academy net riders indonesia 2010 competition
teknik komputer ui
 
DOC
Rencana Proyek Divisi Komputer.doc
teknik komputer ui
 
DOC
Salinan Research Paper
teknik komputer ui
 
PDF
Chapter_1_Case_Study
teknik komputer ui
 
PDF
Iins practice questions
teknik komputer ui
 
PDF
S1 intr ftui
teknik komputer ui
 
PPT
Exploration network chapter7
teknik komputer ui
 
PPT
Exploration network chapter6
teknik komputer ui
 
PPT
Exploration network chapter5
teknik komputer ui
 
PPT
Exploration network chapter4
teknik komputer ui
 
PPT
Exploration network chapter3
teknik komputer ui
 
PPT
Exploration network chapter2
teknik komputer ui
 
PPT
Exploration network chapter1
teknik komputer ui
 
PPT
Exploration network chapter11
teknik komputer ui
 
PDF
Chapter1
teknik komputer ui
 
PDF
Chapter3 bag1
teknik komputer ui
 
PDF
Chapter2 bag1
teknik komputer ui
 
PDF
Chapter4
teknik komputer ui
 
PPT
Dasar komputer chapter3
teknik komputer ui
 
The cisco networking academy net riders indonesia 2010 competition
teknik komputer ui
 
Rencana Proyek Divisi Komputer.doc
teknik komputer ui
 
Salinan Research Paper
teknik komputer ui
 
Chapter_1_Case_Study
teknik komputer ui
 
Iins practice questions
teknik komputer ui
 
S1 intr ftui
teknik komputer ui
 
Exploration network chapter7
teknik komputer ui
 
Exploration network chapter6
teknik komputer ui
 
Exploration network chapter5
teknik komputer ui
 
Exploration network chapter4
teknik komputer ui
 
Exploration network chapter3
teknik komputer ui
 
Exploration network chapter2
teknik komputer ui
 
Exploration network chapter1
teknik komputer ui
 
Exploration network chapter11
teknik komputer ui
 
Chapter3 bag1
teknik komputer ui
 
Chapter2 bag1
teknik komputer ui
 
Dasar komputer chapter3
teknik komputer ui
 

Chapter2 bag2

  • 1. 2.1 Introduction to Object- Oriented Programming
  • 2. 2.1.1 Procedural versus OOP languages • Procedural programming involves creating a sequence of instructions • OOP uses a collection of interacting objects • Functions are logically grouped, making enhancements easy • OOP can model human problem- solving
  • 3. 2.1.2 Basic Java terminology Object. contains data and instructions Class. blueprint for an object Attribute. describe the state of objects Data Type. describes what kind of information a certain attribute is Behavior. describe what objects can do Method. a set of instructions Inheritance. Some objects derive attributes and behaviors from other objects Encapsulation. Combining data and methods together
  • 4. 2.2 What are Objects? 2.2.1 Introduction to objects • Anything tangible or abstract that is relevent • Objects can have attributes and behaviors • Attributes describe the object • Behaviors describe what the object can do
  • 5. 2.2.2 Classification of objects • User Interface objects – Objects that the user interacts directly with • Operating environment objects – Provide services to other components • Task Related objects – Documents, multimedia, problem domain
  • 6. 2.2.3 Objects - identifying, defining, creating and operating on • Identifying – Requires needs assessment • Defining – Classification, relationships, operations. The class keyword • Creating – The constructor and the new keyword • Operating – Using an object’s methods
  • 7. 2.2.7 Encapsulation • To hide the details, package together • Access modifiers – public, private and protected
  • 8. 2.2.8 Object relationships • Association – Objects know about each other • Whole-part – Existance of an object relies on another • Inheritance – Attributes & behaviors can be inherited
  • 10. 2.2.10 Object mutability and destruction • Some object attributes should be immutable, or unchangable • To make an item immutable, use the final keyword • The JVM automatically releases memory when objects are no longer required • The garbage collector will reclaim memory by objects that are no longer referenced • Garage collection is not controllable
  • 11. 2.3.1 Modeling languages and symbols • Unified Modeling Language (UML) standardizes symbols & terminology for diagramming objects
  • 12. 2.3.2 Basic Class symbol • Rectangle represents a class of objects • 3 compartments: Name, attributes , and operations or methods • Symbols indicate accessibility
  • 13. 2.4.1 Class definition •Defined by using public class Person { private String name; the class keyword public Person(String theName) { •Public classes name = theName; defined in separate } } files •Filename must be the same as the class name
  • 14. 2.4.2 Creating objects • Constructor methods are called when an object is created • All object data is stored in memory • Variables are a reference to the memory location
  • 15. 2.4.3 Object methods • Mutator – Changes object data • Accessor – Retrieves object data • Methods with no arguments • Methods that require arguments • Method return values – Provide a result to the caller
  • 16. 2.5.1 System class • Data stored by an object is member data • Data present in an object’s methods is called local or temporary data • Java.lang.System is a pre-defined object that can be used to perform system tasks System.out.println(“Hello World!”);