public class ClassLoaderTest
{
public static void main(String[] args)
{
ClassLoader c1=System.class.getClassLoader();
System.out.println(c1==null?"null":c1.getClass().getName());
c1=javax.swing.Box.class.getClassLoader();
System.out.println(c1==null?"null":c1.getClass().getName());
c1=sun.net.spi.nameservice.dns.DNSNameService.class.getClassLoader();
System.out.println(c1==null?"null":c1.getClass().getName());
c1=ClassLoaderTest.class.getClassLoader();
System.out.println(c1==null?"null":c1.getClass().getName());
c1=c1.getParent();
System.out.println(c1==null?"null":" "+c1.getClass().getName());
c1=c1.getParent();
System.out.println(c1==null?"null":" "+c1.getClass().getName());
}
}
java 类装载器
最新推荐文章于 2024-11-11 00:03:55 发布