Chapter 11
The Making of Objects

   11.1 Classes
   11.2 Access to Objects
   11.3 Attributes of Objects
   11.4 Behavior of Objects
   11.5 Classes as Objects
   11.6 Sources of Information
   11.7 Assignment #12: Using Class Methods

11.1 Classes

class Account { 
  static int balance; 
  static void transfer(int amount){} 
  int name; 
  Account(String name){} 
  int loan; 
  void borrow (int amount){} 
  void pay (int amount){} 
  int checking; 
  void deposit (int amount){} 
  void withdraw (int amount){} 
} 

11.2 Access to Objects

class prg{ 
  public static void main( String [] args ){ 
     Account acc1, acc2; 
     acc1 = new Account( "Joe" ); 
     acc2 = new Account( "Jane" ); 
     acc1 = new Account( "Tom" ); 
} } 
             Account
            |--------------------|
            |    |------balance  |
            |                    |
            | ||||--||||--|||--  |
            ---------------|||---
     |----------------
acc1 |----------
acc2 ------

11.3 Attributes of Objects

         |Account-------------|
         |     |------balance |
         |                    |
         |  -|||-    ||||     |
       ------|||-----|--------
   -----||||||||     |||||||----|||
 -||----|     ||||  ||||----|     |||
|-|-----| loan   -|  |-|-----| loan   --
--|-----| checking-  --|-----| checking-
 |||----  name||-    |||----  name||-
   ||||||||||||        ||||||||||||

11.4 Behavior of Objects

acc1.borrow( 100 ); 
acc2.pay(200 ); 
acc1.deposit( 300 ); 
acc2.withdraw( 400 ); 

11.5 Classes as Objects

11.6 Sources of Information

11.7 Assignment #12: Using Class Methods

Due: Fr, May 2, midnight

Consider the incomplete program given below.

class lab12{ 
  public static void main (String [] args ){ 
 
  } 
} 
class MyClass{ 
 
} 
Notes

Note: Files that fail to compile, and execute when applicable, will not be examined. They will be awarded a grade of 0 points.

Q&A