Presentation is loading. Please wait.

Presentation is loading. Please wait.

Instance Method – CSC142 Computer Science II

Similar presentations


Presentation on theme: "Instance Method – CSC142 Computer Science II"— Presentation transcript:

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

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

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

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

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

6 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 ( )

7 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

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

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


Download ppt "Instance Method – CSC142 Computer Science II"

Similar presentations


Ads by Google