Java ClassLoader delegation model?

前端 未结 6 1560
悲哀的现实
悲哀的现实 2021-02-01 08:35

When calling loadClass() on a ClassLoader, does the ClassLoader first check if the class has been loaded, or does it immediately delegate this check to

6条回答
  •  無奈伤痛
    2021-02-01 09:16

    There's one more issue that should be noted in this context. The API doc says:

    The methods and constructors of objects created by a class loader may reference other classes. To determine the class(es) referred to, the Java virtual machine invokes the loadClass method of the class loader that originally created the class.

    Meaning that networks of referencing classes are loaded by the same class loader.

提交回复
热议问题