 <p>It is due to the polymorphism.</p> <p>Reference of parent class can hold the child class object.But using this reference you can call methods those are correctly overridden in the child class.</p>