1. Concept of class loading mechanism. The Java VIRTUAL machine loads the data describing the Class from the Class file to the memory, verifies, transforms, and initializes the data, and finally forms Java types that can be directly used by the VM. This is the LOADING mechanism of the VIRTUAL machine. After the Class file is loaded by the Class loader, a meta-information object describing the structure of the Class is formed in the JVM. This meta-information object can be used to learn the structure of the Class: Java allows the user to invoke Class functions indirectly through the class-related meta-information object, such as constructors, properties, and methods.
2. Which parts of class file bytecode are composed of? http://www.importnew.com/24088.html
3.1 Magic number 3.2 Version 3.3 Constant Pool 3.4 Access_Flag 3.5 Class Index 3.6 Superclass Index 3.7 Interface Index 3.8 Field Table Set 3.9 MethodsCopy the code
3. The class loading process can be broken down into several steps. The entire life cycle of a class from the moment it is loaded into virtual machine memory to the moment it is unloaded from memory includes: 2, Loading, Verification, Preparation, Resolution, Initialization, using and Unloading are stages. The three parts of validation, preparation and parsing are collectively referred to as Linking. The sequence of these seven stages is shown in the figure below:
The process stages: http://blog.csdn.net/fgets/article/details/52934178 http://blog.csdn.net/u011080472/article/details/51329315
4. When class loading occurs. http://blog.csdn.net/liang_70121385/article/details/52496028
Class initialization
1. Classes are initialized from top to bottom, so fields declared at the top are initialized earlier than fields at the bottom 2. Superclasses precede the initialization of subclasses and derived classes 3. If the initialization of a class is triggered by accessing a static field, then only classes declaring a static field are initialized, and neither superclass initialization nor subclass 4 is triggered. Initialization even if the static field is referenced by a subclass or subinterface or its implementation class. 5. Initialization of the interface does not cause initialization of the parent interface. 6. Static fields are initialized during the static initialization of a class, and non-static fields during the creation of an instance of a class. This means that the static field is initialized before the non-static field. 7. Non-static fields are initialized by constructors. The constructor implicitly calls the parent class's constructor before the child class does any initialization, which ensures that non-static or instance variables (the parent class) are initialized before the child classCopy the code
6, class loader, and parents to model the significance of http://www.importnew.com/25295.html by mechanism – to prevent the occurrence of more than the same bytecode in memory
Can you write your own class called java.lang.system?
Answer: No, java.lang.system in the JDK is loaded by the parent class loader. Explanation: A Class that begins with Java. In a particular directory is reported SecurityException if it is forcibly loaded using a custom class loader.
However, we can do this by defining a class loader of our own, which must also be special in order to avoid the parent delegate mechanism. Since the system’s three classloaders all load classes in a specific directory, if our own classloader is placed in a specific directory, the system’s loader will not be able to load, which is ultimately loaded by our own loader.
http://www.cnblogs.com/lanxuezaipiao/p/4138511.html