Activity of Aug. 27, 2010

Post date: Aug 27, 2010 5:32:19 AM

One part of Project 3 that we have not yet talked about is how the example Garage class in main() is able to display such a nice looking inventory with a simple System.out.println(garage); even though System.out knows next to nothing about the database. The output is shown below. It manages this through operator overloading (similar to some constructors we've seen), inheritance, and delegation.

Process started >>>

Your garage holds 3 bikes.

0:

Blue Batavus 700 x 700

1:

Bumble Bee 26 x 26

2:

Red Rocket 20 x 26

High Racer 26 x 26

Pack 1 spare(s).

High Racer: Look, no hands!

Your garage holds 3 bikes.

0:

Blue Batavus 700 x 700

1:

Bumble Bee 26 x 26

2:

High Racer 26 x 26

<<< Process finished.