java how to load a class code example

Example 1: custom classloader

loader name---- sun.misc.Launcher$AppClassLoader
Class Loading Started for test.frugalis.Frugalis
*********Inside getClass*********
Name of Filetest\frugalis\Frugalis.class
<<<<<<<<<Inside loadClassData>>>>>>
Size of byte array 519
Class Loading Started for java.lang.Object
Loaded class name: test.frugalis.Frugalis
Class Loading Started for java.lang.System
Class Loading Started for java.io.PrintStream
Welcome Frugalis Minds

Example 2: custom classloader

package test.frugalis;
 
public class Frugalis {
 
	public void printMyName(){
		System.out.println("Welcome Frugalis Minds");
	}
}

Tags:

Misc Example