adithya narayan wrote:You mean there is only one object creation per 'new' usage ? Can you elaborate more on the latter statement where you say SubA also a SuperA object ?
That's what inheritance means - there is an IS-A relationship. It's easier to see with more natural classes (rather than artificial ones like SubA). To pick an overused example:
Here, we say a Dog IS-AN Animal. An instance of the Dog class is also an instance of the Animal class: if you use the
instanceof operator to check it will return true.
adithya narayan wrote:What about java reflection. Aren't constructors used to create/construct objects using reflection ? Please correct me if i am wrong.
Constructor
objects are, but that's a bit different. Creating the object will still cause the constructor to be executed for the class you're instantiating and
every super class.