 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| |
When
you create an array of objects
|
|
|
|
|
You
are really creating an array of references
|
|
|
|
|
Which
are automatically initialized to null
|
|
|
|
|
Java
interprets a null as being a reference which isnt
|
|
|
pointing
to an object
|
|
|
|
|
You
must assign an object to each reference before
|
|
|
you
use it!
|
|
|
|
|
And,
if you try to use a reference while it is still null,
|
|
|
you
will get a run-time error reported
|
|
|
|
|
Plus,
Java provides for range checking so that arrays
|
|
cannot
be accessed outside of range
|
|