In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what are the common methods of java class loaders". The explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the common methods of java class loaders".
1. LoadClass, when the class load request arrives, the class object is first found in the cache.
If there is a direct return, if not, give it to the loaded parent loader to load. If there is no parent load, give it to the top-level boot loader to load. If you can't find it in the end, load it with findClass ().
2 、 FindClass
The Class bytecode is loaded by name or location, and then using defineClass is usually implemented by subclasses, which must be overridden if you need to customize the ClassLoader.
3 、 defineClass
The defineClass () method parses the byte bytestream into a Class object that JVM can recognize (this method logic has been implemented in ClassLoader). This method can instantiate not only class objects through class files, but also class objects through other methods, for example, receiving a class of bytecode over the network and then converting it to byte bytestreams to create corresponding Class objects, while the defineClass () method is usually used with the findClass () method. Usually, when you customize the class loader, you will directly override the findClass () method of Classloader and write the loading rules, get the bytecode of the class to load and convert it into a stream, and then call the defineClass () method to generate the Class object of the class, which is simply to convert the classs file into a Classs object.
4. ResolveClass can also be parsed at the same time when it is created using a Class-like object.
We said earlier that the link phase mainly validates bytecode, allocates memory, sets class variables, and converts symbol references in bytecode files into direct references.
What are the advantages of Java. Simple, as long as understand the basic concepts, you can write applications suitable for a variety of situations; 2. Object oriented; 3. Distributed, Java is a network-oriented language; 4. Robust, java provides automatic garbage collection for memory management to prevent programmers from making mistakes when managing memory. ; 5. Security, Java used in the network and distributed environment must prevent the invasion of viruses. 6. Architecturally neutral, as long as the Java runtime system is installed, it can run on any processor. 7. Portability, Java can be easily ported to different machines on the network. 8. Interpretation execution, Java interpreter directly interprets and executes Java bytecode.
Thank you for your reading, these are the contents of "what are the common methods of java class loaders?" after the study of this article, I believe you have a deeper understanding of what the common methods of java class loaders have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.