[Quote=引用 11 楼 huoyin 的回复:]
你怎么不查查JDK的文档呢?我给你贴出来算了:
loadClass
public Class loadClass(String name)
throws ClassNotFoundException
Loads the class with the specified name. This method searches for classes in the same manner as the loadClass(String, boolean) method. It is invoked by the Java virtual machine to resolve class references. Invoking this method is equivalent to invoking loadC…
[/Quote]
你怎么不查查JDK的文档呢?我给你贴出来算了:
loadClass
public Class loadClass(String name)
throws ClassNotFoundException
Loads the class with the specified name. This method searches for classes in the same manner as the loadClass(String, boolean) method. It is invoked by the Java virtual machine to resolve class references. Invoking this method is equivalent to invoking loadClass(name, false).
Parameters:
name - The name of the class
Returns:
The resulting Class object
Throws:
ClassNotFoundException - If the class was not found
loadClass
protected Class loadClass(String name,
boolean resolve)
throws ClassNotFoundException
Loads the class with the specified name. The default implementation of this method searches for classes in the following order:
Invoke findLoadedClass(String) to check if the class has already been loaded.
Invoke the loadClass method on the parent class loader. If the parent is null the class loader built-in to the virtual machine is used, instead.
Invoke the findClass(String) method to find the class.
If the class was found using the above steps, and the resolve flag is true, this method will then invoke the resolveClass(Class) method on the resulting Class object.
Subclasses of ClassLoader are encouraged to override findClass(String), rather than this method.
Parameters:
name - The name of the class
resolve - If true then resolve the class
Returns:
The resulting Class object
Throws:
ClassNotFoundException - If the class could not be found