Object Oriented Programming Concepts Fatih University Ceng-104-A Introduction to Object Oriented Programming Harun Reşit Zafer This is a slide version.

Slides:



Advertisements
Similar presentations
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
Advertisements

Computer Science Dept. Fall 2003 Object models Object models describe the system in terms of object classes An object class is an abstraction over a set.
BITS Pilani Avinash Gautam Department of Computer Science and Information Systems.
1 Object-Oriented Programming Concepts. 2 Recap from last lecture Variables and types –int count Assignments –count = 55 Arithmetic expressions –result.
OBJECT-ORIENTED PROGRAMMING CONCEPTS (Review). What is an Object? What is an Object? Objects have states and behaviors. Example: A dog has states - color,
Classes and Objects in Java. What Is an Object?. An object is a software bundle of related state and behavior. Software objects are often used to model.
INSTRUCTOR: SHIH-SHINH HUANG Windows Programming Using Java Chapter3: Introduction to Classes and Objects 1.
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;
EEC-681/781 Distributed Computing Systems Java Tutorial Wenbing Zhao Cleveland State University
Nov 5, Fall 2006IAT 8001 Lecture 5 Objects, Classes.
Introduction to Alice Basics : What is Alice? Object Oriented Definitions What Does it Look Like? Where Can I Use it?
Object-oriented Programming Concepts
Object Oriented Paradigm Programming Paradigms En Mohd Norafizal A.Aziz.
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.
CSC241: Object Oriented Programming
1 Windows Programming with Java Oğuzhan Öztaş. 2 Java Books -Java Examples in a nutshell O’REILLY -Java Cookbook O’REILLY -Java 2 Core Language Little.
CS415 C++ Programming Takamitsu Kawai x4212 G11 CERC building WV Virtual Environments Lab West Virginia University.
1 Pertemuan 6 Object Oriented Programming Matakuliah: T0053/Web Programming Tahun: 2006 Versi: 2.
Lecture 1 Introduction to Java MIT- AITI 2004 What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word.
1 Object Oriented Programming with JAVA References: Java JDK6 documentations. Java™ How to Program, Sixth Edition Instructor:
Java Implementation Software Construction Lecture 6.
Object-Oriented Programming Concepts
______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |
Chapter 4 Objects and Classes.
About the Java  Java technology is both a programming language and a platform –The Java Programming Language A high-level language that can be characterized.
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA Prof. Dr. Paulo Brasko Ferreira Fall 2014.
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.
Java. Features of Java Architecture Neutral and Portable o Write once, run anywhere o Java Virtual Machine (JVM) Object Oriented o Classes encapsulate.
CS216 / SE2111 Chapter 04 Introduction to Classes and Objects.
Object Oriented Programming Concepts. Object ► An object is a software bundle of related state and behavior. ► Software objects are often used to model.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
Ihsan Ayyub Qazi Introduction to Computer Programming Recitation 3 Ihsan Ayyub Qazi.
What Is a Package? A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar.
By : Robert Apeldorn. What is OOP?  Object-oriented programming is a programming paradigm that uses “objects” to design applications and computer programs.
Classes and Objects. How can one design a program?  Top-down structured design: uses algorithmic decomposition where each module denotes a major step.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Object and Classes อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 3.
Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes.
Object Oriented Programming in Java Habib Rostami Lecture 2.
Systems Analysis & Programming 10.1 Systems Development 10.2 Programming: A Five-Step Procedure Generations of Programming Languages 10.4 Programming.
Introduction to Object-oriented Programming
Object-Oriented programming for Beginners LEAPS Computing 2015
GC211 Data structure Lecture 3 Sara Alhajjam.
What is an Object Objects are key to understanding object-oriented technology. An object can be considered a "thing" that can perform a set of related.
UML - Class Diagrams.
JAVA By Waqas.
Objects as a programming concept
Object-oriented programming 面向对象程序设计
University of Central Florida COP 3330 Object Oriented Programming
Objects as a programming concept
University of Central Florida COP 3330 Object Oriented Programming
03/10/14 Chapter 9 Inheritance.
OBJECT ORIENTED CONCEPTS
EEC 484 Computer Networks Java Tutorial #1 Wenbing Zhao
PRG 421 Education on your terms/snaptutorial.com.
PRG 421 Education on your terms/tutorialrank.com.
PRG 421 GUIDE Knowledge is divine-- prg421guide.com.
PRG 421 Week 1 Individual: Week One Coding Assignment--
Lecture 5 from (Chapter 4, pages 73 to 96)
Unit-2 Objects and Classes
البرمجة الكينونية بلغة جافا 1294
class PrintOnetoTen { public static void main(String args[]) {
Introducing Java.
Presentation transcript:

Object Oriented Programming Concepts Fatih University Ceng-104-A Introduction to Object Oriented Programming Harun Reşit Zafer This is a slide version of the on-line tutorial at:

Overview ➲ What is an Object? ➲ What is a Class? ➲ What is Inheritance? ➲ What is Package?

What Is an Object? ➲ An object is a software bundle of related state and behavior. ➲ This lesson explains how state and behavior are represented within an object, introduces the concept of data encapsulation, and explains the benefits of designing your software in this manner.

What Is an Object? ➲ Objects are key to understanding object- oriented technology ➲ Look around right now and you'll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.

Real-world objects share two characteristics: ➲ State and Behavior ➲ Dogs have state: name, color, breed, hungry ➲ Dogs have behavior: Barking Fetching wagging tail

Real-world objects share two characteristics: ➲ Bicycles also have state current gear current pedal turn per time current speed ➲ And behavior changing gear changing pedal cadence applying brakes

Ask yourself two questions: ➲ What possible states can this object be in? ➲ What possible behavior can this object perform? ➲ Let's talk about student object

Consider a bicycle, for example: ➲ A bicycle modeled as a software object.

What Is a Class? ➲ In the real world, you'll often find many individual objects all of the same kind. ➲ There may be thousands of other bicycles in existence, all of the same make and model. ➲ Each bicycle was built from the same set of blueprints and therefore contains the same components.

What Is a Class? ➲ In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. ➲ A class is the blueprint from which individual objects are created.

class Bicycle ➲ class Bicycle { ➲ int cadence = 0;//turn count per time ➲ int speed = 0; ➲ int gear = 1; ➲ void changeCadence(int newValue) { ➲ cadence = newValue; ➲ } ➲ void changeGear(int newValue) { ➲ gear = newValue; ➲ } ➲ void speedUp(int increment) { ➲ speed = speed + increment; ➲ } ➲ void applyBrakes(int decrement) { ➲ speed = speed - decrement; ➲ } ➲ void printStates() { ➲ System.out.println("cadence:"+cadence+" speed:"+speed+" gear:"+gear); ➲ } ➲ }//class

class BicycleDemo ➲ class BicycleDemo { ➲ public static void main(String[] args) { ➲ // Create two different Bicycle objects ➲ Bicycle bike1 = new Bicycle(); ➲ Bicycle bike2 = new Bicycle(); ➲ // Invoke methods on those objects ➲ bike1.changeCadence(50); ➲ bike1.speedUp(10); ➲ bike1.changeGear(2); ➲ bike1.printStates(); ➲ bike2.changeCadence(50); ➲ bike2.speedUp(10); ➲ bike2.changeGear(2); ➲ bike2.changeCadence(40); ➲ bike2.speedUp(10); ➲ bike2.changeGear(3); ➲ bike2.printStates(); ➲ } ➲ }//class

Class Student ➲ Let's write the code on NetBeans together