![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
You can combine array creation and element insertion when the elements are
of type Movie
, just as you can combine array creation and element
insertion when the elements are of type int
.
For example, if you wish to create
a four-element array of specific movies, you can write the following, in
which all Movie
instances happen to be created with the
three-parameter constructor:
Movie movies[] = {new Movie(5, 6, 3), new Movie(8, 7, 7), new Movie(7, 2, 2), new Movie(7, 5, 5)};