SlideShare a Scribd company logo
1 of 16
Download to read offline
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

What's hot

Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Sakthi Durai
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
International Journal of Engineering and Science Invention (IJESI)
International Journal of Engineering and Science Invention (IJESI)International Journal of Engineering and Science Invention (IJESI)
International Journal of Engineering and Science Invention (IJESI)inventionjournals
 
Introduction Of Java
Introduction Of JavaIntroduction Of Java
Introduction Of JavaAfreen Shaikh
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programmingSachin Sharma
 

What's hot (6)

Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
Virtual Enterprise Model
Virtual Enterprise ModelVirtual Enterprise Model
Virtual Enterprise Model
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
International Journal of Engineering and Science Invention (IJESI)
International Journal of Engineering and Science Invention (IJESI)International Journal of Engineering and Science Invention (IJESI)
International Journal of Engineering and Science Invention (IJESI)
 
Introduction Of Java
Introduction Of JavaIntroduction Of Java
Introduction Of Java
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 

Viewers also liked (8)

Modul 4
Modul 4Modul 4
Modul 4
 
Modul 1
Modul 1Modul 1
Modul 1
 
Modul 3
Modul 3Modul 3
Modul 3
 
Modul 1
Modul 1Modul 1
Modul 1
 
Modul 5
Modul 5Modul 5
Modul 5
 
Procedural programming
Procedural programmingProcedural programming
Procedural programming
 
Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++
 
Procedural programming
Procedural programmingProcedural programming
Procedural programming
 

Similar to Chapter2 bag2

Power of introspection
Power of introspectionPower of introspection
Power of introspectionJoseph Jeffrey
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxethiouniverse
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Fahad Golra
 
Concepts for Object Oriented Databases.ppt
Concepts for Object Oriented Databases.pptConcepts for Object Oriented Databases.ppt
Concepts for Object Oriented Databases.pptnafsigenet
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with javaSujit Kumar
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfssusere9cd04
 
Hibernate in XPages
Hibernate in XPagesHibernate in XPages
Hibernate in XPagesToby Samples
 
Softwear presentation
Softwear presentationSoftwear presentation
Softwear presentationAlina Asif
 
MODELLING WITH OBJECTS.pptx
MODELLING WITH OBJECTS.pptxMODELLING WITH OBJECTS.pptx
MODELLING WITH OBJECTS.pptxTarun710971
 
Object Oriented Programming in JavaScript
Object Oriented Programming in JavaScriptObject Oriented Programming in JavaScript
Object Oriented Programming in JavaScriptzand3rs
 
Integrating Doctrine with Laravel
Integrating Doctrine with LaravelIntegrating Doctrine with Laravel
Integrating Doctrine with LaravelMark Garratt
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfArpitaJana28
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialscesarmendez78
 

Similar to Chapter2 bag2 (20)

m211c25.ppt
m211c25.pptm211c25.ppt
m211c25.ppt
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Power of introspection
Power of introspectionPower of introspection
Power of introspection
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptx
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2
 
Concepts for Object Oriented Databases.ppt
Concepts for Object Oriented Databases.pptConcepts for Object Oriented Databases.ppt
Concepts for Object Oriented Databases.ppt
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdf
 
Hibernate in XPages
Hibernate in XPagesHibernate in XPages
Hibernate in XPages
 
Softwear presentation
Softwear presentationSoftwear presentation
Softwear presentation
 
4-OOPS.pptx
4-OOPS.pptx4-OOPS.pptx
4-OOPS.pptx
 
MODELLING WITH OBJECTS.pptx
MODELLING WITH OBJECTS.pptxMODELLING WITH OBJECTS.pptx
MODELLING WITH OBJECTS.pptx
 
Object Oriented Programming in JavaScript
Object Oriented Programming in JavaScriptObject Oriented Programming in JavaScript
Object Oriented Programming in JavaScript
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
 
Integrating Doctrine with Laravel
Integrating Doctrine with LaravelIntegrating Doctrine with Laravel
Integrating Doctrine with Laravel
 
01 chapter
01 chapter01 chapter
01 chapter
 
25dom
25dom25dom
25dom
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdf
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
 
Doctrine2
Doctrine2Doctrine2
Doctrine2
 

More from teknik komputer ui (20)

Modul 2
Modul 2Modul 2
Modul 2
 
The cisco networking academy net riders indonesia 2010 competition
The cisco networking academy net riders indonesia 2010 competitionThe cisco networking academy net riders indonesia 2010 competition
The cisco networking academy net riders indonesia 2010 competition
 
Rencana Proyek Divisi Komputer.doc
Rencana Proyek Divisi Komputer.docRencana Proyek Divisi Komputer.doc
Rencana Proyek Divisi Komputer.doc
 
Salinan Research Paper
Salinan Research PaperSalinan Research Paper
Salinan Research Paper
 
Chapter_1_Case_Study
Chapter_1_Case_StudyChapter_1_Case_Study
Chapter_1_Case_Study
 
Iins practice questions
Iins practice questionsIins practice questions
Iins practice questions
 
S1 intr ftui
S1 intr ftuiS1 intr ftui
S1 intr ftui
 
Exploration network chapter7
Exploration network chapter7Exploration network chapter7
Exploration network chapter7
 
Exploration network chapter6
Exploration network chapter6Exploration network chapter6
Exploration network chapter6
 
Exploration network chapter5
Exploration network chapter5Exploration network chapter5
Exploration network chapter5
 
Exploration network chapter4
Exploration network chapter4Exploration network chapter4
Exploration network chapter4
 
Exploration network chapter3
Exploration network chapter3Exploration network chapter3
Exploration network chapter3
 
Exploration network chapter2
Exploration network chapter2Exploration network chapter2
Exploration network chapter2
 
Exploration network chapter1
Exploration network chapter1Exploration network chapter1
Exploration network chapter1
 
Exploration network chapter11
Exploration network chapter11Exploration network chapter11
Exploration network chapter11
 
Chapter1
Chapter1Chapter1
Chapter1
 
Chapter3 bag1
Chapter3 bag1Chapter3 bag1
Chapter3 bag1
 
Chapter2 bag1
Chapter2 bag1Chapter2 bag1
Chapter2 bag1
 
Chapter4
Chapter4Chapter4
Chapter4
 
Dasar komputer chapter3
Dasar komputer chapter3Dasar komputer chapter3
Dasar komputer chapter3
 

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!”);