I came to know that in a inherited structure like a inherits b, b inherits c etc with each having a constructor when i create a object first constructor of Object is executed . Does it mean that memory for any object is actually defined in the Object(Object is the base class for all existing java objects) constuctor method ? Also please help me with what will happen if I create an A object and A doesn't have a constructor defined whereas B has a constructor defined ? What if in the above case B has a constructor with 2 arguments and I have to call it in A's constructor ?
Joined: Aug 04, 2004
Why you don't try write such class where A has default constructor and B has constructor with parameters? You will see what is the result.
It means that every new type has some 'Object-ness' to it, yes. In recent versions of Java many elements of the Object class are made static to account for that fact.
Every new type has a constructor, no matter what. You can write the access rights to a constructor so that no one outside the class can call it, but there still must be a constructor for every class. It makes no difference if a class provides its own or if the compiler silently inserts one to maintain the chaining process back to java.lang.Object, the basae supertype.
Make visible what, without you, might perhaps never have been seen. - Robert Bresson