O'Reilly logo
  • Chintan Shah thinks this is interesting:

Create two new Dog objects, and assign them to the first two array elements.

pets[0] = new Dog();
pets[1] = new Dog();

From

Cover of Head First Java, 2nd Edition

Note

just reminding myself, that in order to create an array, you need to allocate an array (new), and in order to create the objects for the references at different indexes, you need to allocate (new) again. Basically array itself is again a reference; not a primitive variable.