Objects as a programming concept

Slides:



Advertisements
Similar presentations
Color Templates Software Engineering Module: Core of Java Topic: Constructors TALENTSPRINT | © Copyright 2012.
Advertisements

AP Computer Science A – Healdsburg High School 1 Unit 3 - Classes and Objects - Example.
OBJECT-ORIENTED PROGRAMMING CONCEPTS (Review). What is an Object? What is an Object? Objects have states and behaviors. Example: A dog has states - color,
Syntax & terminology review While the following slides are not exactly what we did on the board (object diagrams are not shown here) they cover most of.
Classes and Objects: Recap A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
1 Composition A whole-part relationship (e.g. Dog-Tail) Whole and part objects have same lifetime –Whole creates instance of part in its constructor In.
 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
OOP & JAVA. HelloWorld.java /** * The HelloWorld class is an application that * displays "Hello World!" to the standard output. */ public class HelloWorld.
What is an object? Your dog, your desk, your television set, your bicycle. Real-world objects share two characteristics: They all have state and behavior;
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
Classes and Objects in Java
Classes and Objects  A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
What is a class? a class definition is a blueprint to build objects its like you use the blueprint for a house to build many houses in the same way you.
Problem Solving #3: JVM ICS Outline Review of Key Topics Review of Key Topics Problem 1 Problem 1 Problem 2 Problem 2 Problem 3 Problem 3 Problem.
Introduction to Programming. To gain a sound knowledge of programming principles To gain a sound knowledge of object- orientation To be able to critically.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
Java Objects and Classes. 3-2 Object Oriented Programming  An OO program models the application as a world of interacting objects.  A typical Java program.
Inheritance using Java
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
1 Chapter 3 and 6– Classes, Objects and Methods Object-Oriented Programming Concepts – Read it from Java TutorialJava Tutorial Definition: A class is a.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Introduction to Java Programming. History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled.
Lecture 1 Introduction to Java MIT-AITI Ethiopia 2004.
Specialization and Inheritance Chapter 8. 8 Specialization Specialized classes inherit the properties and methods of the parent or base class. A dog is.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Computer Science and Engineering College of Engineering The Ohio State University Interfaces The credit for these slides goes to Professor Paul Sivilotti.
OBJECTS AND CLASSES CITS1001. Concepts for this lecture class; object; instance method; parameter; signature data type multiple instances; state method.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Classes 1 COMPSCI 105 S Principles of Computer Science.
Object-Oriented Design Justin Callanan CS 597. Object-Oriented Basics ● Data is stored and processed in “objects” ● Objects represent generalized real.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
Lec 14 Writing an Instantiable Class III. Agenda Review of Instantiable Classes Scope of variables Using this to override scope issues Lab: Creating a.
Interfaces Chapter 9. 9 Creating Interfaces An interface is a contract. Every class that implements the interface must provide the interface’s defined.
Java Basic Syntax. Object - Objects have states and behaviors. –Example: A dog has states-color, name, breed as well as behaviors -wagging, barking, eating.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Object Oriented Programming I ( ) Dr. Adel hamdan Part 03 (Week 4) Dr. Adel Hamdan Date Created: 7/10/2011.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
Object and Classes อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 3.
 An object is basically anything in the world that can be created and manipulated by a program.  Examples: dog, school, person, password, bank account,
IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.
Introduction to Java Chapter 1 - Introduction to Java1 Chapter 1 Introduction to Java.
Objects as a programming concept
Object-Oriented Programming Concepts
3 Introduction to Classes and Objects.
Java Events. Java Events Important definitions Overridden method Class vs. abstract class vs. interface Event Handling Definition Main components Windows.
Classes and OOP.
Objects as a programming concept
University of Central Florida COP 3330 Object Oriented Programming
Table of Contents Class Objects.
Object Oriented Programming
OBJECT ORIENTED CONCEPTS
FUNDAMENTALS OF JAVA.
What is an object? An object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the.
Interfaces.
Inheritance Inheritance is a fundamental Object Oriented concept
Object-Oriented Programming
Defining Classes and Methods
Which best describes the relationship between classes and objects?
Overview of Java 6-Apr-19.
Chapter 14 Abstract Classes and Interfaces
Object-Oriented Programming Concepts
Inheritance and Polymorphism
Unit-2 Objects and Classes
Classes and Objects CGS3416 Spring 2019.
Abstract Data Types Abstraction is to distill a system to its most fundamental parts. Applying the abstraction paradigm to the design of data structures.
Presentation transcript:

Objects as a programming concept

Topic D.1.1 Outline the general nature of an object

Definition: object An object is a ‘thing’. An object is an abstract entity. It has two components: data and actions.

Object & Class Object - Objects have states (variables) and behaviors (methods). Example: A dog has states - color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class. Class - A class can be defined as a template/blue print that describes the behaviors/states that object of its type support.

Real world vs Software What are real-world objects? Cars, Dogs, Humans, etc. All these objects have a state and behavior. If we consider a dog, then its state is - name, breed, color, and the behavior is - barking, wagging, running Software objects also have a state and behavior. A software object's state is stored in fields and behavior is shown via methods.

Example: Fields States Methods Behaviours

Constructors Every class has a constructor. Each time a new object is created, at least one constructor will be invoked (called/run). The main rule of constructors is that they should have the same name as the class. A class can have more than one constructor.

Steps in object creation: A class provides the blueprints for objects. An object is created from a class. In Java, the new key word is used to create new objects. There are three steps when creating an object from a class: Declaration: A variable declaration with a variable name with an object type. Instantiation: The 'new' key word is used to create the object. Initialization: The 'new' keyword is followed by a call to a constructor. This call initializes the new object.

Example: Output:

Summary of code

Output:

We tend to split classes Many methods Object Class main() Running Class

Output:

Summary – key terms Think Pair Share Object Class State Behaviour Field Method Constructor Declaration Instantiation Initialization