Explain the processes performed by java virtual machine, i.e. loading, linking, initialization.- Locating the binary representation of a type and bringing it to the JVM is the process of loading.
- Linking is the process by which type and incorporating it into the runtime state of the JVM takes place, in order to execute.
- Initialization is the process for executing the initializers of a type – static and field initializers. A type is garbage collected when a type becomes unreachable ( application could not find the reference).
Explain the processes performed by java virtual machine, i.e. loading, linking, initialization.The Java virtual machine dynamically loads, links, and initializes classes and interfaces.
1. Loading is the process of finding the binary form of a class or interface type with a particular name, a Class object to represent the class or interface.
2. This is done perhaps by computing it on the fly, but more typically by retrieving a binary representation previously computed from source code by a compiler and constructing, from that binary form.
3. The binary format of a class or interface is normally the class file format.
4. A class or interface type is always loaded before it is linked. Linking is the process of taking a binary form of a class or interface type and combining it into the runtime state of the Java virtual machine, so that it can be executed.
5. Three different activities are involved in linking:
ii. preparation, and
iii. resolution of symbolic references.
6. Initialization of a class consists of executing its static initializers and the initializers for static fields declared in the class. Initialization of an interface consists of executing the initializers for fields declared in the interface