Steps of constructing an object: 1) The Java virtual machine allocates enough unused memory in the heap that can be used to hold the object; 2) The Java virtual machine insures proper initialization of objects. Set fields to default initial values (0, false, null) 3) Call the constructor for the object (but don't execute the body of the constructor yet) 4) Invoke the constructor of the superclass 5) Initialize fields using initializers and initialization blocks 6) Execute the body of the constructor
if you new an object,after initialization,the object's parameter will endow the variable,the last is constructor,it will bestrow the variable,and finish creating the object!so i think object is the first,constructor is going with it,but i think constructor is finish first!that's just my own opinion.so i don't know if i say that is right!
You can consider the constructor as a process to create an object. and object as the result of constructore. If the constructor fails there will be no object. an object creates itself... through constructor.
The hen creates the egg of itself and come out the egg... do you understand....
if you think you can you r right<br />if you think you can not you r double right
Joined: Jun 22, 2005
Thanks kwan and balaji! I would conclude, "Constructor call and execution... is part of the object creation."
I would like to konw few more things... 1. An abstract class can not be instantiated or its object can not be created. 2. However inheriting an abstract class and instantiatng the same(child-class), calls the (parent)abstract-class's constructor.