sample class loader

This commit is contained in:
Raksha Rao 2018-02-05 15:45:51 +05:30
parent 2f31b4a8cc
commit 20b8dbffc4
2 changed files with 9 additions and 9 deletions

View File

@ -1,22 +1,23 @@
package com.baeldung.classloader;
import com.sun.javafx.util.Logging;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
public class SampleClassLoader {
public void loadClass() throws ClassNotFoundException {
System.out.println("Classloader of this class:"+SampleClassLoader.class.getClassLoader());
Class.forName("com.baeldung.classloader.SampleClassLoader", true
, SampleClassLoader.class.getClassLoader().getParent());
}
public void loadClass() throws ClassNotFoundException {
System.out.println("Classloader of this class:" + SampleClassLoader.class.getClassLoader());
System.out.println("Classloader of Logging:" + Logging.class.getClassLoader());
System.out.println("Classloader of ArrayList:" + ArrayList.class.getClassLoader());
Class.forName("com.baeldung.classloader.SampleClassLoader", true, SampleClassLoader.class.getClassLoader().getParent());
}
}

View File

@ -11,5 +11,4 @@ public class SampleClassLoaderTest {
sampleClassLoader.loadClass();
}
}