OK, this method of creating objects is called:
POLYMORPHISM, and it means that you are giving different definition to the same thing.
Going back to your question, Animal a = new Dog(), is going to create a Dog object because you are calling the Dog() constructor.
The object
reference in this case
a is of type Animal BUT the object itself is of type DOG, there is a big difference between objects and their references and as it was stated by Gupta that objects reside in heap while references in the stack.