Monday 16 March 2015

Q 16 ) What Happens At Object Creation Time ?




Step 1 :  The JVM has to load the class, Since the class is not loaded yet.
Step 2 :  Memory will be allocated for reference variable ,and will be                        initialized to “ NULL ”.
Step 3 : Object will be created.
                 ( memory will be allocated to all instance variables and will be                     initialized to their default values depending on their
                    datatypes ).
Step 4 :  Instance block will be executed.
Step 5 :  Corresponding constructor will be called by the JVM.
Step 6 :  Object address will be assigned to the reference variables and

                 It becomes a complete “ OBJECT ”.

No comments:

Post a Comment