Top
Previous Next
Java Arrays, Objects, Methods CS 161 - Java

References to and Creating Objects

Primitives come into existence by declaring them

   int     count;
   float   distance;
   boolean guilty;
   char    letter;

Declaring an Object type establishes space for an Object reference

But does not, by itself, create the object itself.

Objects must be declared and then instantiated

Creating (Instantiating) and Using Objects

   Insect bug;   // declare name for Insect reference
   bug = new Insect();   // create and save the instance

Top
Previous Next
jwd