What happens when an object is created in java?
1.Memory allocation: To hold all instance variables and implementation-specific data of the object and its super classes.
2. Initialization: the objects are initialized to their default values.
3. Constructor: Constructors call the constructors for its super classes. This process continues until the constructor for java.lang.Object is called, as java.lang.Object is the base class for all objects in java.
4. Execution: Before the body of the constructor is executed all instance variable initializes and initialization blocks must get executed. Then the body of the constructor is executed.