No. It is merely used to hold the static method main()
.
When a program starts running there are no objects,
just class definitions and
a static main()
method.
Usually main()
then constructs
some objects and calls their
methods to do the work of the program.
In our example,
main()
constructs just one object and then calls that object's
area()
and volume()
methods.
The picture shows the variable cone
in the static
main()
method
referring to the object that has been constructed
following the class definition of Cone
.
The static main()
method is part of the
TestCone
class.
In the picture, the class definitions are shown as pink clouds as a reminder that they are not full objects. The object in this picture is shown as a solid rectangle.
Could several objects of type Cone
be constructed?