HOME      BLOG       FORUMS      CONTACT       ABOUT

Loads or initializes a class

The forName methods of Class class can be used for loading or initializing a class.

public class ClazzUtil {
	public static void main(String[] args) throws ClassNotFoundException {
		Class clazz = Class.forName("java.lang.Boolean", true, ClassLoader.getSystemClassLoader());
		
		System.out.println(clazz);
	}
}

or

public class ClazzUtil {
	public static void main(String[] args) throws ClassNotFoundException {
		Class clazz = Class.forName("java.lang.Boolean");
		
		System.out.println(clazz);
	}
}

Share

Tags: , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply