I'm new to java, I was reading Head first Java when I came across object in arrays. The code is from the book itself, I get the flow of the code but I don't really understand the second line. What does new Dog[7]
do, in the book it says
"Declare and Create a Dog array to hold 7 Dog references"
If we have already created dog references why do we need to create a dog reference for individual array items again.
Dog[] pets;
pets = new Dog[7];
pets[0] = new Dog();