Lecture 2 of 12Computer Science A, Spring 2007
PreviousNextOverview

Lecture 2:  Using Objects

Reading material:

  • Chapter 2
  • Section 2.1

    Note: In Java, integers (and other values of primitive types) are not objects. Therefore, two occurences of "object" on page 34 should be "value", namely on line 7 and on line 16. The second yellow margin note on page 34 is correct.

    To be pedantic, note also that some variables do not have a name. This is not important in chapter 2, but will be in chapter 8.

  • Section 2.2-4
  • Section 2.5
  • Section 2.6-7
  • Section 2.8-9
  • Section 2.10

    Note: There are not differences between the way in which a variable containing an integer and the way in which a variable containing an object is assigned the value of another variable: In both cases, whatever is inside that other variable (i.e., either an integer or a reference to an obejct) is copied and stored.

Exercises:

Slides:

1Chapter Goals30Rectangular Shapes and Rectangle Objects
2Types and Variables31Rectangular Shapes and Rectangle Objects
3Syntax 2.1: Variable Definition32Constructing Objects
4Identifiers33Constructing Objects
5Self Check34Syntax 2.3: Object Construction
6Answers35Self Check
7The Assignment Operator36Answers
8Uninitialized Variables37Accessor and Mutator Methods
9Syntax 2.2: Assignment38Self Check
10Self Check39Answers
11Answers40Implementing a Test Program
12Objects and Classes41Importing Packages
13Methods42Syntax 2.4 : Importing a Class from a Package
14A Representation of Two String Objects43File MoveTester.java
15String Methods44Self Check
16Self Check45Answers
17Answers46The API Documentation of the Standard Java Library
18Implicit and Explicit Parameters47The API Documentation for the Rectangle Class
19Return Values48Javadoc Method Summary
20Passing Return Values49translate Method Documentation
21A More Complex Call50Self Check
22Method Definitions51Answers
23Method Definitions52Object References
24Self Check53Object Variables and Number Variables
25Answers54Copying Numbers
26Number Types55Copying Object References
27Arithmetic Operations56Self Check
28Self Check57Answers
29Answers  

You can find a printer-friendly overview here.