Instance Method – CSC142 Computer Science II

Slides:



Advertisements
Similar presentations
Copyright 2008 by Pearson Education Building Java Programs Chapter 8 Lecture 8-3: Encapsulation, toString reading: self-checks: #13-18,
Advertisements

© 2006 Pearson Education Chapter 4: Writing Classes Presentation slides for Java Software Solutions for AP* Computer Science A 2nd Edition by John Lewis,
Road Map Introduction to object oriented programming. Classes
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 3rd Edition.
CS 106 Introduction to Computer Science I 03 / 21 / 2008 Instructor: Michael Eckmann.
CS 112 Intro to Computer Science II Sami Rollins Spring 2007.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
Intro to CS – Honors I Classes and Methods GEORGIOS PORTOKALIDIS
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
APCS Java AB 2004 Review of CS1 and CS2 Review for AP test #1 Sources: 2003 Workshop notes from Chris Nevison (Colgate University) AP Study Guide to go.
ACO 101: Introduction to Computer Science Anatomy Part 2: Methods.
Objects and Classes Chapter 6 CSCI CSCI 1302 – Objects and Classes2 Outline Introduction Defining Classes for Objects Constructing Objects Accessing.
© A+ Computer Science - public Triangle() { setSides(0,0,0); } Constructors are similar to methods. Constructors set the properties.
CSC 142 Computer Science II Zhen Jiang West Chester University
Dale Roberts Object Oriented Programming using Java - Enumerations Dale Roberts, Lecturer Computer Science, IUPUI Department.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
CS442: ADVANCED PROGRAMMING USING JAVA Lab 6: Classes and objects Computer Science Department.
JAVA Classes Review. Definitions Class – a description of the attributes and behavior of a set of computational objects Constructor – a method that is.
CSC 142 Computer Science II Zhen Jiang West Chester University
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Chapter 3 Introduction to Classes and Objects Definitions Examples.
Java Classes Chapter 1. 2 Chapter Contents Objects and Classes Using Methods in a Java Class References and Aliases Arguments and Parameters Defining.
CSC 142 Computer Science II Zhen Jiang West Chester University
Attribute - CIS 1068 Program Design and Abstraction Zhen Jiang CIS Dept. Temple University SERC 347, Main Campus 12/24/2016.
1 Introduction to Computer Science for Majors II CPSC 233, Winter 2013 CPSC 233, winter 2013 Tutorial 7, Feb 6/7, 2013.
CPSC 233 Tutorial 5 February 9 th /10 th, Java Classes Each Java class contains a set of instance variables and methods Instance Variables: Type.
Comp1004: Building Better Objects II Encapsulation and Constructors.
Powerpoint slides from A+ Computer Science Modified by Mr. Smith for his course.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
Re-Intro to Object Oriented Programming
Object - CIS 1068 Program Design and Abstraction
Objects as a programming concept
Examples of Classes & Objects
Objects as a programming concept
Haidong Xue Summer 2011, at GSU
Road Map Introduction to object oriented programming. Classes
Creating Your OwnClasses
CSC115 Introduction to Computer Programming
CSC141 Computer Science I Zhen Jiang Dept. of Computer Science
CS 302 Week 11 Jim Williams, PhD.
Instance Method Review - CIS 1068 Program Design and Abstraction
CSC240 Computer Science III
CSC240 Computer Science III
Inheritance Basics Programming with Inheritance
Defining Classes and Methods
An Introduction to Java – Part II
CSC115 Introduction to Computer Programming
CSC 113: Computer programming II
Simple Classes in C# CSCI 293 September 12, 2005.
Chapter 4 (part 2).
Classes & Objects: Examples
Encapsulation and Constructors
Zhen Jiang West Chester University
CSC240 Computer Science III
More on Classes and Objects
Implementing Classes Chapter 3.
Computer Programming with JAVA
© A+ Computer Science - OOP © A+ Computer Science -
CS2011 Introduction to Programming I Methods (II)
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
Review for Test1.
JAVA CLASSES.
CIS 199 Final Review.
Chapter 9 Objects and Classes
Classes and Objects CGS3416 Spring 2019.
Day 11 The Last Week!.
Presentation transcript:

Instance Method – CSC142 Computer Science II Zhen Jiang CS Dept. West Chester University 4/11/2019

Table of Contents Introduction Declaration and call Access and scope 4/11/2019

Introduction Why? Why loop Why array Why method Why object (the host of instance method)? 4/11/2019

ArrayOperation. java vs. ArrayOperations. java http://www. cs. wcupa 4/11/2019

Every thing under the control inside of object (which must be declared in the class) 4/11/2019

state: String name, breed int age Dog class state: String name, breed int age behavior: writeOutput ( ) getAgeInHumanYears ( )‏ Point object balto state: “Balto” (name) 8 (age) “Siberian Husky” (breed) behavior: getAgeInHumanYears ( ) writeOutput ( ) Point object scooby state: “Balto” (name) 8 (age) “Siberian Husky” (breed) behavior: getAgeInHumanYears ( ) writeOutput ( )

Declaration (signature part) and call Constructor When it is called? Name No return Not static Related to the use of new Overloading 4/11/2019

Mutator Accessor toString Argument and parameter Order and type (compatible & overloading) Primitive type and reference type (array & object) Accessor Return toString 4/11/2019

Access and Scope Attribute (property, data field, etc) Local variable & parameter What is “this” 4/11/2019