Java Reflection - Class.getClassLoader() Examples

Code Snippets Java Reflection Java 


Class:

java.lang.Class

java.lang.Objectjava.lang.Objectjava.lang.Classjava.lang.Classjava.io.SerializableSerializablejava.lang.reflect.GenericDeclarationGenericDeclarationjava.lang.reflect.TypeTypejava.lang.reflect.AnnotatedElementAnnotatedElementLogicBig

Method:

public ClassLoader getClassLoader()

Returns the class loader for the class.

Returns:
the class loader that loaded the class or interface represented by this object.


Examples


package com.logicbig.example.clazz;

public class GetClassLoaderExample {

public static void main(String... args) {
ClassLoader classLoader = GetClassLoaderExample.class.getClassLoader();
System.out.println(classLoader);
}
}

Output

java.net.URLClassLoader@42af1547




See Also