In this article we will look at the sequence in which constructor in inheritance are executed i.e., is the base class constructor invoked first or the derived class constructors is invoked first. Consider two classes participating in simple inheritance. Let A be the super classes and B be the sub class. Now, which constructors is invoked first? Is it the constructor of B followed by the constructors of A or vice versa? The sequence in which the constructor are invoked is from super class to sub class i.e, first the constructors of class A is executed then constructors of class
The post How constructors are used in inheritance in Java Programming appeared first on Coding Security.
How constructors are used in inheritance in Java Programming
read more
Tidak ada komentar:
Posting Komentar