Interface and Abstract Class in Java
Overview Q&A Whenever we are creating a Child class object whether Parent class object will be created or not? Whenever we are creating Child class object automatically Parent constructor will be executed to perform initialization for the instance variables which are inheriting from parent. But it will not create an object of Parent class. It will create the object of only the Child class. Whenever we are creating a Child class object what is the need of executing Parent class constructor? Child class constructor is used to initialize child class properties and Parent class constructor is used to initialize Parent class properties. When you are calling the Child class constructor you have to call Parent class constructor with the help of super keyword. If not the compiler will prompt compile time error. In the below program InterfaceAndAbstractMain both Parent and Child constructor are executed for Child object initialization only. Note: Whenever we are creating Child class ob...