go to previous page   go to home page   go to next page

Answer:

Is the Car class made up of smaller software objects?

What are the instance variables of class Car?

What is the method of class Car?


Construction of a Car

class MpgTester
{
  public static void main ( String[] args )
  {
    Car myCar = new Car( 12000, 12340, 12.3 );

    . . . . . . 
  }
}

The state of an object consists of the values held by its instance variables. These may change during the lifetime of the object. Here is a main() program that constructs a Car object.


QUESTION 3:

Could a collection of several cars be regarded as an object?