- JVM startup
- Loading – finding binary representation of class/interface then constructing the Class object
- Linking – combining class/interface into the run-time state of the JVM so that it can be executed
- Verification - semantic/structure validation
- Preparation - storage allocation, all static fields are created and initialized with default values
- Resolution – optionally resolve symbolic reference to other classes/interfaces
- Initialization – static initialization
- superclass/superinterface static initialization
- superclasses are initialized before subclasses
- interface initialization does not initialize superinterfaces
- only the class that declares static field is initialized, even though it might be referred to through the name of a subclass, a subinterface, or a class that implements an interface
- all static explicit field initializers and static initialization blocks are executed in textual order
- Instantiation - creation of object/class instance
All the instance variables, including those declared in superclasses, are initialized to their default values first. - start the constructor
- call explicit constructor this() if available
- call explicit/implicit super() unless class is Object – process recursively using same steps a. to e.
- all non-static field initializers and non-static initialization blocks are executed in textual order
- execute the rest of the body of constructor
- Finalization – finalize() method is called before storage for object is reclaimed by GC
- Unloading – happens if its classloader is reclaimed by GC. Bootstrap loader may not be unloaded.
- Program Exit
Sunday, September 8, 2013
Steps involved during Execution of a Java Program
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment