In Chapter 9, you saw how to create an instance in one statement and
to initialize that instance's instance variables in others. The following
illustrates instance creation and initialization for a Movie
variable, m
:
Movie m = new Movie(); m.script = 8; m.acting = 9; m.direction = 6;
As the new Movie
instance is created, zeros are assigned to all the
arithmetic instance variables. Then, three statements reassign those
instance variables.