Object Oriented Design: Identifying Objects

Size: px
Start display at page:

Download "Object Oriented Design: Identifying Objects"

Transcription

1 Object Oriented Design: Identifying Objects

2 Review What did we do in the last lab? What did you learn? What classes did we use? What objects did we use? What is the difference between a class and an object?

3 Classes An object is defined by a class A class is the blueprint of an object: A class represents a concept, and an object represents the embodiment (i.e., concrete instance) of that concept The class uses methods to define behaviors of the object Multiple objects can be created from the same class Copyright 2012 Pearson Education, Inc.

4 Class = Blueprint One blueprint to create several similar, but different, houses: Copyright 2012 Pearson Education, Inc.

5 Let s play a game: Identify Classes Behaviors/actions Information/data Input/output

6 Basic class structure public class ClassName { Fields Constructors Methods } Three major components of a class: Fields store data for the object to use Constructors allow the object to be set up properly when first created Methods implement the behavior of the object

7 Classes/objects (state/behaviors) Car My first car a maroon Saab 9000 Chair Book Java Software Solutions, 7 th Edition Table Student Teacher

8 More Identification Think about activities you do everyday What real-world entities do you interact with? What about programs you use? Your phone, laptop/desktop Identify Classes Information/data Behaviors/actions

9 Basic class structure public class ClassName { Fields Constructors Methods } Three major components of a class: Fields store data for the object to use Constructors allow the object to be set up properly when first created Methods implement the behavior of the object

10 Object-Oriented Programming (OOP) Objects make it easier to reuse code that others have written Java comes with built-in OO functionality (standard library) Objects commonly represent real-world entities For instance, an object might be a particular employee in a company Each employee object handles the processing and data management related to that employee OO is to programming like the assembly line was to industrialization Copyright 2012 Pearson Education, Inc.

11 Fields Fields store values for an object. They are also known as instance variables. Fields define the state of an object. public class Square { private int x; private int y; private int size; private Color fillcolor; } // Further details omitted. visibility modifier type variable name private int size; Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling

12 Similar Names for Fields All of these terms can be used interchangeably: Fields Instance Variables Characteristics Data Attributes Properties The values of the fields define the object s state

13 Data Types boolean char int long float double String Student (any class) true, false a z,a Z,[symbols] integers larger integers (2x) floating decimal larger floating decimal (2x) characters strung together defined class

14 8 Primitive Data Types in Java Four represent integers: byte, short, int, long Two represent floating point numbers (with decimals): float, double One represents single characters: char One represents boolean values: boolean What about other data? It must be defined as a class! Copyright 2012 Pearson Education, Inc.

15 Numeric Primitive Data Why so many types to hold numbers? Different sizes affect what values can be stored: Type Storage Min Value Max Value byte short int long 8 bits 16 bits 32 bits 64 bits ,768-2,147,483,648 < -9 x ,767 2,147,483,647 > 9 x float double 32 bits 64 bits +/- 3.4 x with 7 significant digits +/- 1.7 x with 15 significant digits Copyright 2012 Pearson Education, Inc.

16 Constructors public Square() { x = 0; y = 0; size = 0; color = Color.blue; } Constructors initialize an object. They have the same name as their class. They store initial values into the fields. They often receive external parameter values for this. Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling

17 Methods method header/signature visibility modifier return type method name /** * Gets the size of the square. */ public int getsize() { return size; } start and end of method body (block) parameter list (empty) return statement Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling

18 What we discussed today Classes and objects What they are How to identify them How to identify their components Data types

19 Homework Work on and submit Lab 2 Work with Codingbat exercises Read Chapter 2

Lab: PiggyBank. Defining objects & classes

Lab: PiggyBank. Defining objects & classes Lab: PiggyBank Defining objects & classes Review: Basic class structure public class ClassName { Fields Constructors Methods } Three major components of a class: Fields store data for the object to use

More information

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented

More information

Ticket Machine Project(s)

Ticket Machine Project(s) Ticket Machine Project(s) Understanding the basic contents of classes Produced by: Dr. Siobhán Drohan (based on Chapter 2, Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes,

More information

Objects First with Java A Practical Introduction using BlueJ

Objects First with Java A Practical Introduction using BlueJ Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling Extensions by H.-J. Bungartz and T. Neckel 2.1 Course Contents Introduction to object-oriented programming with

More information

Objects First with Java A Practical Introduction using BlueJ

Objects First with Java A Practical Introduction using BlueJ Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling Extensions by H.-J. Bungartz, T. Neckel and M. Roderus 2.1 Course Contents Introduction to object-oriented programming

More information

Object-Oriented Programming Concepts

Object-Oriented Programming Concepts Object-Oriented Programming Concepts Real world objects include things like your car, TV etc. These objects share two characteristics: they all have state and they all have behavior. Software objects are

More information

Inheritance. Improving Structure with Inheritance. Dr. Siobhán Drohan Mairead Meagher. Produced by:

Inheritance. Improving Structure with Inheritance. Dr. Siobhán Drohan Mairead Meagher. Produced by: Inheritance Improving Structure with Inheritance Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Lectures and Labs This weeks lectures and labs

More information

Lecture 8 Classes and Objects Part 2. MIT AITI June 15th, 2005

Lecture 8 Classes and Objects Part 2. MIT AITI June 15th, 2005 Lecture 8 Classes and Objects Part 2 MIT AITI June 15th, 2005 1 What is an object? A building (Strathmore university) A desk A laptop A car Data packets through the internet 2 What is an object? Objects

More information

UNDERSTANDING CLASS DEFINITIONS CITS1001

UNDERSTANDING CLASS DEFINITIONS CITS1001 UNDERSTANDING CLASS DEFINITIONS CITS1001 Main concepts to be covered Fields / Attributes Constructors Methods Parameters Source ppts: Objects First with Java - A Practical Introduction using BlueJ, David

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information

6.092: Java for 6.170

6.092: Java for 6.170 6.092: Java for 6.170 Lucy Mendel MIT EECS MIT 6.092 IAP 2006 1 Course Staff Lucy Mendel Corey McCaffrey Rob Toscano Justin Mazzola Paluska Scott Osler Ray He Ask us for help! MIT 6.092 IAP 2006 2 Class

More information

Programming for Mobile Computing

Programming for Mobile Computing 1/57 Programming for Mobile Computing EECS 1022 moodle.yorku.ca Labs 2/57 For the things we have to learn before we can do them, we learn by doing them. Aristotle During the labs, carefully read the instructions,

More information

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003 Outline Object Oriented Programming Autumn 2003 2 Course goals Software design vs hacking Abstractions vs language (syntax) Java used to illustrate concepts NOT a course about Java Prerequisites knowledge

More information

Chapter 12 Object-Oriented Programming. Starting Out with Games & Graphics in C++ Tony Gaddis

Chapter 12 Object-Oriented Programming. Starting Out with Games & Graphics in C++ Tony Gaddis Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics in C++ Tony Gaddis Addison Wesley is an imprint of 2010 Pearson Addison-Wesley. All rights reserved. 12.1 Procedural and Object-Oriented

More information

Objects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes

Objects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes Based on Introduction to Java Programming, Y. Daniel Liang, Brief Version, 10/E 1 Creating Classes and Objects Classes give us a way of defining custom data types and associating data with operations on

More information

A A B U n i v e r s i t y

A A B U n i v e r s i t y A A B U n i v e r s i t y Faculty of Computer Sciences O b j e c t O r i e n t e d P r o g r a m m i n g Week 10: I n h e r i t a n c e Asst. Prof. Dr. M entor Hamiti mentor.hamiti@universitetiaab.com

More information

Lec 3. Compilers, Debugging, Hello World, and Variables

Lec 3. Compilers, Debugging, Hello World, and Variables Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted

More information

CSC Java Programming, Fall Java Data Types and Control Constructs

CSC Java Programming, Fall Java Data Types and Control Constructs CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference

More information

Today s Agenda. Quick Review

Today s Agenda. Quick Review Today s Agenda TA Information Homework 1, Due on 6/17 Quick Review Finish Objects and Classes Understanding class definitions 1 Quick Review What is OOP? How is OOP different from procedural programming?

More information

Exam 1 - (20 points)

Exam 1 - (20 points) Exam 1 - (20 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth 1 point (unless otherwise stated).

More information

Java Identifiers, Data Types & Variables

Java Identifiers, Data Types & Variables Java Identifiers, Data Types & Variables 1. Java Identifiers: Identifiers are name given to a class, variable or a method. public class TestingShastra { //TestingShastra is an identifier for class char

More information

CS 170 Java Programming 1. Week 13: Classes, Testing, Debugging

CS 170 Java Programming 1. Week 13: Classes, Testing, Debugging CS 170 Java Programming 1 Week 13: Classes, Testing, Debugging What s the Plan? Short lecture for makeup exams Topic 1: A Little Review How to create your own user-defined classes Defining instance variables,

More information

Object-Oriented Programming (OOP) Basics. CSCI 161 Introduction to Programming I

Object-Oriented Programming (OOP) Basics. CSCI 161 Introduction to Programming I Object-Oriented Programming (OOP) Basics CSCI 161 Introduction to Programming I Overview Chapter 8 in the textbook Building Java Programs, by Reges & Stepp. Review of OOP History and Terms Discussion of

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

Introduction to Java Programming

Introduction to Java Programming Boaz Kantor Introduction to Computer Science, Fall semester 2009-2010 IDC Herzliya Welcome, geeks! Introduction to Java Programming Plan for today: 1. Before we begin.. 2. What is Java? 3. How to program?

More information

JAVA MOCK TEST JAVA MOCK TEST II

JAVA MOCK TEST JAVA MOCK TEST II http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 02: Using Objects MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Using Objects 2 Introduction to Object Oriented Programming Paradigm Objects and References Memory Management

More information

OBJECT INTERACTION. CITS1001 week 3

OBJECT INTERACTION. CITS1001 week 3 OBJECT INTERACTION CITS1001 week 3 2 Fundamental concepts Coupling and Cohesion Internal/external method calls null objects Chaining method calls Class constants Class variables Reading: Chapter 3 of Objects

More information

Computer Science II Data Structures

Computer Science II Data Structures Computer Science II Data Structures Instructor Sukumar Ghosh 201P Maclean Hall Office hours: 10:30 AM 12:00 PM Mondays and Fridays Course Webpage homepage.cs.uiowa.edu/~ghosh/2116.html Course Syllabus

More information

Homework Set 2- Class Design

Homework Set 2- Class Design 1 Homework Set 2- Class Design By the end of the lesson students should be able to: a. Write the Java code define a class, its data members, and its constructors. b. Write a tostring() method for a class.

More information

Understanding class definitions. Looking inside classes (based on lecture slides by Barnes and Kölling)

Understanding class definitions. Looking inside classes (based on lecture slides by Barnes and Kölling) Understanding class definitions Looking inside classes (based on lecture slides by Barnes and Kölling) Main Concepts fields constructors methods parameters assignment statements Ticket Machines (an external

More information

Basic Operations jgrasp debugger Writing Programs & Checkstyle

Basic Operations jgrasp debugger Writing Programs & Checkstyle Basic Operations jgrasp debugger Writing Programs & Checkstyle Suppose you wanted to write a computer game to play "Rock, Paper, Scissors". How many combinations are there? Is there a tricky way to represent

More information

VARIABLES AND TYPES CITS1001

VARIABLES AND TYPES CITS1001 VARIABLES AND TYPES CITS1001 Scope of this lecture Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Primitive types Every piece of data

More information

CITS1001 week 4 Grouping objects

CITS1001 week 4 Grouping objects CITS1001 week 4 Grouping objects Arran Stewart March 20, 2018 1 / 31 Overview In this lecture, we look at how can group objects together into collections. Main concepts: The ArrayList collection Processing

More information

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

(800) Toll Free (804) Fax   Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented

More information

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and Classes CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

CS 251 Intermediate Programming Methods and More

CS 251 Intermediate Programming Methods and More CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

Second-generation: Assembly language. Figure 6.1 Generations of programming languages. Assembly Language Characteristics.

Second-generation: Assembly language. Figure 6.1 Generations of programming languages. Assembly Language Characteristics. Chapter 6: Programming Languages Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Chapter 6: Programming Languages 6.1 Historical Perspective 6.2 Traditional Programming Concepts 6.3

More information

Chapter 6: Programming Languages

Chapter 6: Programming Languages Chapter 6: Programming Languages Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6: Programming Languages

More information

Chapter3: Introduction to Classes and Objects

Chapter3: Introduction to Classes and Objects Chapter3: Introduction to Classes and Objects Classes and Objects: Definitions Objectives What is an object What is a class UML representation of a class Objects and Instance variables Primitive types

More information

Scope of this lecture

Scope of this lecture ARRAYS CITS11 2 Scope of this lecture Arrays (fixed size collections) Declaring and constructing arrays Using and returning arrays Aliasing Reading: Chapter 7 of Objects First with Java 6 th Edition Chapter

More information

Outline. Review of Last Week II. Review of Last Week. Computer Memory. Review Variables and Memory. February 7, Data Types

Outline. Review of Last Week II. Review of Last Week. Computer Memory. Review Variables and Memory. February 7, Data Types Data Types Declarations and Initializations Larry Caretto Computer Science 16 Computing in Engineering and Science February 7, 25 Outline Review last week Meaning of data types Integer data types have

More information

Structured Programming

Structured Programming CS 170 Java Programming 1 Objects and Variables A Little More History, Variables and Assignment, Objects, Classes, and Methods Structured Programming Ideas about how programs should be organized Functionally

More information

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014 Lesson 10A OOP Fundamentals By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Definition Pointers vs containers Object vs primitives Constructors Methods Object class

More information

OBJECTS FIRST WITH JAVA 5TH EDITION PDF

OBJECTS FIRST WITH JAVA 5TH EDITION PDF OBJECTS FIRST WITH JAVA 5TH EDITION PDF ==> Download: OBJECTS FIRST WITH JAVA 5TH EDITION PDF OBJECTS FIRST WITH JAVA 5TH EDITION PDF - Are you searching for Objects First With Java 5th Edition Books?

More information

Objects and Classes Lecture 2

Objects and Classes Lecture 2 Objects and Classes Lecture 2 Waterford Institute of Technology January 12, 2016 John Fitzgerald Waterford Institute of Technology, Objects and ClassesLecture 2 1/32 Classes and Objects Example of class

More information

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING THROUGH C++ Practical: OOPS THROUGH C++ Subject Code: 1618407 PROGRAM NO.1 Programming exercise on executing a Basic C++

More information

2. The object-oriented paradigm

2. The object-oriented paradigm 2. The object-oriented paradigm Plan for this section: Look at things we have to be able to do with a programming language Look at Java and how it is done there Note: I will make a lot of use of the fact

More information

Values, Variables, Types & Arithmetic Expressions. Agenda

Values, Variables, Types & Arithmetic Expressions. Agenda Values, Variables, Types & Arithmetic Expressions Lecture 2 Object-Oriented Programming Agenda Inside of a Computer Value Variable Data Types in Java Literals Identifiers Type conversions Manipulating

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space. Chapter 2: Problem Solving Using C++ TRUE/FALSE 1. Modular programs are easier to develop, correct, and modify than programs constructed in some other manner. ANS: T PTS: 1 REF: 45 2. One important requirement

More information

JAVA GUI PROGRAMMING REVISION TOUR III

JAVA GUI PROGRAMMING REVISION TOUR III 1. In java, methods reside in. (a) Function (b) Library (c) Classes (d) Object JAVA GUI PROGRAMMING REVISION TOUR III 2. The number and type of arguments of a method are known as. (a) Parameter list (b)

More information

Java Basic Datatypees

Java Basic Datatypees Basic Datatypees Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory. Based on the data type of a variable,

More information

9 Working with the Java Class Library

9 Working with the Java Class Library 9 Working with the Java Class Library 1 Objectives At the end of the lesson, the student should be able to: Explain object-oriented programming and some of its concepts Differentiate between classes and

More information

AP Computer Science A Summer Assignment

AP Computer Science A Summer Assignment Mr. George AP Computer Science A Summer Assignment Welcome to AP Computer Science A! I am looking forward to our class. Please complete the assignment below. It is due on the first day back to school in

More information

Some miscellaneous concepts

Some miscellaneous concepts Some miscellaneous concepts Static, Javadoc and Calculated Data Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Topic List Static Variables Static

More information

Defining Classes. Chap 1 introduced many concepts informally, in this chapter we will be more formal in defining

Defining Classes. Chap 1 introduced many concepts informally, in this chapter we will be more formal in defining Defining Classes Chap 1 introduced many concepts informally, in this chapter we will be more formal in defining Classes, fields, and constructors Methods and parameters, mutators and accessors Assignment

More information

Objects First With Java 5th Edition Solutions

Objects First With Java 5th Edition Solutions We have made it easy for you to find a PDF Ebooks without any digging. And by having access to our ebooks online or by storing it on your computer, you have convenient answers with objects first with java

More information

Java. Representing Data. Representing data. Primitive data types

Java. Representing Data. Representing data. Primitive data types Computer Science Representing Data Java 02/23/2010 CPSC 449 161 Unless otherwise noted, all artwork and illustrations by either Rob Kremer or Jörg Denzinger (course instructors) Representing data Manipulating

More information

Lecture 6 Introduction to Objects and Classes

Lecture 6 Introduction to Objects and Classes Lecture 6 Introduction to Objects and Classes Outline Basic concepts Recap Computer programs Programming languages Programming paradigms Object oriented paradigm-objects and classes in Java Constructors

More information

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 4

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 4 Computational Applications in Nuclear Astrophysics using Java Java course Lecture 4 Prepared for course 160410/411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself

More information

C# INTRODUCTION. Object. Car. data. red. moves. action C# PROGRAMMERS GUIDE LESSON 1. CsGuideL1.doc. Date Started: May 8,2001

C# INTRODUCTION. Object. Car. data. red. moves. action C# PROGRAMMERS GUIDE LESSON 1. CsGuideL1.doc. Date Started: May 8,2001 1 C# PROGRAMMERS GUIDE LESSON 1 File: CsGuideL1.doc Date Started: May 8,2001 Last Update: Aug 10, 2006 Version 2003-2005 C# INTRODUCTION This manual introduces the C# programming language techniques and

More information

SELECTION. (Chapter 2)

SELECTION. (Chapter 2) SELECTION (Chapter 2) Selection Very often you will want your programs to make choices among different groups of instructions For example, a program processing requests for airline tickets could have the

More information

Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A

Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia University, Montreal, Canada These slides has been

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the

More information

Chapter 11: Create Your Own Objects

Chapter 11: Create Your Own Objects Chapter 11: Create Your Own Objects Think Java: How to Think Like a Computer Scientist 5.1.2 by Allen B. Downey Our usual text takes a fairly non-standard departure in this chapter. Instead, please refer

More information

JAVA PROGRAMMERS GUIDE LESSON

JAVA PROGRAMMERS GUIDE LESSON 1 JAVA PROGRAMMERS GUIDE LESSON 1 File: JavaL1.doc Date Started: July 12,1998 Last Update: Dec 28, 2005 Java Version: 1.5 INTRODUCTION This manual introduces the Java programming language techniques and

More information

Grouping objects. Main concepts to be covered

Grouping objects. Main concepts to be covered Grouping objects Collections and iterators 3.0 Main concepts to be covered Collections Loops Iterators Arrays Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes, Michael Kölling

More information

Stacks. Chapter 5. Copyright 2012 by Pearson Education, Inc. All rights reserved

Stacks. Chapter 5. Copyright 2012 by Pearson Education, Inc. All rights reserved Stacks Chapter 5 Copyright 2012 by Pearson Education, Inc. All rights reserved Contents Specifications of the ADT Stack Using a Stack to Process Algebraic Expressions A Problem Solved: Checking for Balanced

More information

EXAM Computer Science 1 Part 1

EXAM Computer Science 1 Part 1 Maastricht University Faculty of Humanities and Science Department of Knowledge Engineering EXAM Computer Science 1 Part 1 Block 1.1: Computer Science 1 Code: KEN1120 Examiner: Kurt Driessens Date: Januari

More information

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved. Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;

More information

A foundation for programming. Classes and objects. Overview. Java primitive types. Primitive types Creating your own data types

A foundation for programming. Classes and objects. Overview. Java primitive types. Primitive types Creating your own data types Classes and objects A foundation for programming any program you might want to write objects functions and modules build even bigger programs and reuse code http://www.flickr.com/photos/vermegrigio/5923415248/

More information

OBJECT INTERACTION CITS1001

OBJECT INTERACTION CITS1001 OBJECT INTERACTION CITS1001 Overview Coupling and Cohesion Internal/external method calls null objects Chaining method calls Class constants Class variables A digital clock Abstraction and modularization

More information

A SHIFT OF ACCENT IN INTRODUCTORY OBJECT ORIENTED PROGRAMMING COURSES. Eugeni Gentchev*, Claudia Roda**

A SHIFT OF ACCENT IN INTRODUCTORY OBJECT ORIENTED PROGRAMMING COURSES. Eugeni Gentchev*, Claudia Roda** A SHIFT OF ACCENT IN INTRODUCTORY OBJECT ORIENTED PROGRAMMING COURSES Eugeni Gentchev*, Claudia Roda** * The American University of Paris, Computer Science Department 148 rue de Grenelle, 75007 Paris,

More information

DATA STRUCTURES CHAPTER 1

DATA STRUCTURES CHAPTER 1 DATA STRUCTURES CHAPTER 1 FOUNDATIONAL OF DATA STRUCTURES This unit introduces some basic concepts that the student needs to be familiar with before attempting to develop any software. It describes data

More information

COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP Primitive and Class Types. Yi Hong May 14, 2015 COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

More information

OOSE2 Vererbung und Polymorphie mit BlueJ

OOSE2 Vererbung und Polymorphie mit BlueJ OOSE2 Vererbung und Polymorphie mit BlueJ Lehrstuhl Softwaretechnologie, Dr. Birgit Demuth Sommersemester 2016 Erweiterung von HelloLibrary (U02) SS 2016 OOSE 2 2 BlueJ SS 2016 OOSE 2 3 HelloLibrary (U02):

More information

Guessing Game with Objects

Guessing Game with Objects Objectives Lab1: Guessing Game with Objects Guessing Game with Objects 1. Practice designing and implementing an object-oriented program. 2. Use Console I/O in Java. Tasks 1. Design the program (problem

More information

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba Laboratory Session: Exercises on classes Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down

More information

Lecture 1: Overview & Intro to Java

Lecture 1: Overview & Intro to Java Lecture 1: Overview & Intro to Java CS 62 Spring 2018 Alexandra Papoutsaki & William Devanny http://www.cs.pomona.edu/classes/cs062 1 Welcome! https://commons.wikimedia.org/w/index.php?curid=8004317 2

More information

CS 170, Section /3/2009 CS170, Section 000, Fall

CS 170, Section /3/2009 CS170, Section 000, Fall Lecture 18: Objects CS 170, Section 000 3 November 2009 11/3/2009 CS170, Section 000, Fall 2009 1 Lecture Plan Homework 5 : questions, comments? Managing g g Data: objects to make your life easier ArrayList:

More information

Software Practice 1 Basic Grammar

Software Practice 1 Basic Grammar Software Practice 1 Basic Grammar Basic Syntax Data Type Loop Control Making Decision Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim (42) T.A. Sujin Oh Junseong Lee (43) 1 2 Java Program //package details

More information

Test 1. CSC 121 Lecture Lecturer: Howard Rosenthal. March 4, 2014

Test 1. CSC 121 Lecture Lecturer: Howard Rosenthal. March 4, 2014 1 Test 1. CSC 121 Lecture 21199 Lecturer: Howard Rosenthal March 4, 2014 Your Name: KEY The following questions (or parts of questions) in numbers 1-16 are all worth 2 points each. 1. Fill in the following

More information

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda

More information

The class diagram contains only 2 elements: LabClass and Student. The LabClass class is linked to the Student class.

The class diagram contains only 2 elements: LabClass and Student. The LabClass class is linked to the Student class. Instant download and all chapters Solution Manual Objects First with Java A Practical Introduction Using BlueJ 5th Edition David J. Barnes Michael Kolling https://testbankdata.com/download/solution-manual-objects-first-java-practicalintroduction-using-bluej-5th-edition-david-j-barnes-michael-kolling/

More information

COMP 250 Winter 2011 Reading: Java background January 5, 2011

COMP 250 Winter 2011 Reading: Java background January 5, 2011 Almost all of you have taken COMP 202 or equivalent, so I am assuming that you are familiar with the basic techniques and definitions of Java covered in that course. Those of you who have not taken a COMP

More information

Software Practice 1 - OOP (1) Class and Method

Software Practice 1 - OOP (1) Class and Method Software Practice 1 - OOP (1) Class and Method What is OOP? Defining Classes Using Classes References vs. Values Encapsulate Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim (42) T.A. Sujin Oh Junseong

More information

12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension.

12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Covered in this chapter Classes Objects Methods Parameters double primitive type } Create a new class (GradeBook) } Use it to create an object.

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College September 6, 2017 Outline Outline 1 Chapter 2: Data Abstraction Outline Chapter 2: Data Abstraction 1 Chapter 2: Data Abstraction

More information

CS212:Data Structure

CS212:Data Structure CS212:Data Structure Object Oriented Programming (OOP): What, Why, How? Analyzing and Designing OO Programs (Objects & Classes) Java Syntax, Java Program Skeleton Analyzing and Designing a Program Preparing

More information

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science Department Lecture 3: C# language basics Lecture Contents 2 C# basics Conditions Loops Methods Arrays Dr. Amal Khalifa, Spr 2015 3 Conditions and

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

Curriculum Map Grade(s): Subject: AP Computer Science

Curriculum Map Grade(s): Subject: AP Computer Science Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History

More information

Software Practice 1 - OOP (1) Class and Method What is OOP? Defining Classes Using Classes References vs. Values Encapsulate

Software Practice 1 - OOP (1) Class and Method What is OOP? Defining Classes Using Classes References vs. Values Encapsulate 1 Software Practice 1 - OOP (1) Class and Method What is OOP? Defining Classes Using Classes References vs. Values Encapsulate Prof. Hwansoo Han T.A. Jeonghwan Park 41 T.A. Sung-in Hong 42 2 Objects in

More information

Introduction to CS102

Introduction to CS102 Introduction to CS102 CS102 Algorithms and Programming II Objectives Undertake real-world design task Work as a member of a team Practice communication in written & oral form Learn more programming techniques

More information

Express Yourself. Writing Your Own Classes

Express Yourself. Writing Your Own Classes Java Programming 1 Lecture 5 Defining Classes Creating your Own Classes Express Yourself Use OpenOffice Writer to create a new document Save the file as LastFirst_ic05 Replace LastFirst with your actual

More information

Introduc)on to tes)ng with JUnit. Workshop 3

Introduc)on to tes)ng with JUnit. Workshop 3 Introduc)on to tes)ng with JUnit Workshop 3 We have to deal with errors Early errors are usually syntax errors. The compiler will spot these. Later errors are usually logic errors. The compiler cannot

More information

Fundamentals of Programming Data Types & Methods

Fundamentals of Programming Data Types & Methods Fundamentals of Programming Data Types & Methods By Budditha Hettige Overview Summary (Previous Lesson) Java Data types Default values Variables Input data from keyboard Display results Methods Operators

More information