What is the loading process of Java classes?

The focus of this article

This article will learn the loading process of the class. The java command puts the class file into the class loader, so what happened after that? This article will study it.

Class loading method?

Two loading methods: implicit loading (static loading) and explicit loading (dynamic loading)

Implicit loading means that when a program uses new to create an object, it will implicitly call the class loader to load the corresponding class into the JVM.

Explicit loading refers to loading the required class into the JVM (from loading to linking to initialization) by directly calling the class.forName("class name") method. There is also the use of the classLoader.loadClass("class name") method (only loading, no linking, and no initialization).

 

step

 

life cycle of a class

In general, it can be divided into three steps: loading, connection, initialization, and connection can be divided into three small steps ( verification, preparation, analysis )

load

Loading is to use the class loader to load the class file into memory. classLoader (class loader) will be introduced in detail in the next article.

connect

verify

Guess you like

Origin blog.csdn.net/huanfeng_AI/article/details/132005830
Recommended