The class object returned by Class.forName can decide whether to initialize. The type returned by Classloader.loadclass is never initialized, and only the connection operation is done.
Class.forName can decide which classloader to request this type. And Classloader.loadclass is using the current ClassLoader to request.
The JDBC Registration driver basically uses class.forname.
public static class<?> forname (String name, Boolean Initialize,classloader loader) throws classnotfoundexception;
public static class<?> forname (String className) throws ClassNotFoundException;
Note: Initialize: If True, the type is connected, validated, and initialized before the class object is returned. (for example, execute code in a static block)
Loader: Use a custom class loader to request this type; Of course, you can also pass in null, using the bootstrap loader.
Protected synchronized class<?> loadclass (String name, Boolean resolve) throws ClassNotFoundException;
Public class<?> loadclass (String name) throws ClassNotFoundException;
Note: Resolve: Indicates whether the type needs to be connected, including a checksum class file, ready to allocate memory, type constant pool substitution, but not initialize the type.
The Class.forName and ClassLoader of Java notes