|
Java's Object Orientation, I/O
|
CS 161 - Java |
Objects are created by applying the new operator to a
class, naming one of the class' constructors
You can (generally) create as many object instances of a class as you
need. (Constrained only by the memory available to the JVM.)
The reference (handle) to an instance of an object that has been
created needs to be saved somewhere:
- in a variable,
- in an array,
- in some other object,
- in some collection of objects.
Otherwise the instance of an object will eventually get reclaimed by
Java's built-in garbage collection mechanism.