java.lang.Object
|
+--java.lang.Class
Instances of the class
Class represent classes and interfaces
in a running Java application. Every array also belongs to a class that is
reflected as a Class object that is shared by all arrays with
the same element type and number of dimensions. The primitive Java types
(boolean, byte, char,
short, int, long,
float, and double), and the keyword
void are also represented as Class objects.
Class has no public constructor. Instead Class
objects are constructed automatically by the Java Virtual Machine as classes
are loaded and by calls to the defineClass method in the class
loader.
The following example uses a Class object to print the
class name of an object:
void printClassName(Object obj) {
System.out.println("The class of " + obj +
" is " + obj.getClass().getName());
}
ClassLoader.defineClass(byte[], int, int), Serialized Form
| Method Summary | |
static Class |
forName(String className)
copy-> Class.forName( )copy-> <Class var>=Class.forName(<String className>);
|
static Class |
forName(String name,
boolean initialize,
ClassLoader loader)
copy-> Class.forName(, , )copy-> <Class var>=Class.forName(<String name>, <boolean initialize>, <ClassLoader loader>);
|
Class[] |
getClasses()
copy-> .getClasses()copy-> <Class var>=<Class>.getClasses();
|
ClassLoader |
getClassLoader()
copy-> .getClassLoader()copy-> <ClassLoader var>=<Class>.getClassLoader();
|
Class |
getComponentType()
copy-> .getComponentType()copy-> <Class var>=<Class>.getComponentType();
|
Constructor |
getConstructor(Class[] parameterTypes)
copy-> .getConstructor( )copy-> <Constructor var>=<Class>.getConstructor(<Class[] parameterTypes>);
|
Constructor[] |
getConstructors()
copy-> .getConstructors()copy-> <Constructor var>=<Class>.getConstructors();
|
Class[] |
getDeclaredClasses()
copy-> .getDeclaredClasses()copy-> <Class var>=<Class>.getDeclaredClasses();
|
Constructor |
getDeclaredConstructor(Class[] parameterTypes)
copy-> .getDeclaredConstructor( )copy-> <Constructor var>=<Class>.getDeclaredConstructor(<Class[] parameterTypes>);
|
Constructor[] |
getDeclaredConstructors()
copy-> .getDeclaredConstructors()copy-> <Constructor var>=<Class>.getDeclaredConstructors();
|
Field |
getDeclaredField(String name)
copy-> .getDeclaredField( )copy-> <Field var>=<Class>.getDeclaredField(<String name>);
|
Field[] |
getDeclaredFields()
copy-> .getDeclaredFields()copy-> <Field var>=<Class>.getDeclaredFields();
|
Method |
getDeclaredMethod(String name,
Class[] parameterTypes)
copy-> .getDeclaredMethod(, )copy-> <Method var>=<Class>.getDeclaredMethod(<String name>, <Class[] parameterTypes>);
|
Method[] |
getDeclaredMethods()
copy-> .getDeclaredMethods()copy-> <Method var>=<Class>.getDeclaredMethods();
|
Class |
getDeclaringClass()
copy-> .getDeclaringClass()copy-> <Class var>=<Class>.getDeclaringClass();
|
Field |
getField(String name)
copy-> .getField( )copy-> <Field var>=<Class>.getField(<String name>);
|
Field[] |
getFields()
copy-> .getFields()copy-> <Field var>=<Class>.getFields();
|
Class[] |
getInterfaces()
copy-> .getInterfaces()copy-> <Class var>=<Class>.getInterfaces();
|
Method |
getMethod(String name,
Class[] parameterTypes)
copy-> .getMethod(, )copy-> <Method var>=<Class>.getMethod(<String name>, <Class[] parameterTypes>);
|
Method[] |
getMethods()
copy-> .getMethods()copy-> <Method var>=<Class>.getMethods();
|
int |
getModifiers()
copy-> .getModifiers()copy-> <int var>=<Class>.getModifiers();
|
String |
getName()
copy-> .getName()copy-> <String var>=<Class>.getName();
|
Package |
getPackage()
copy-> .getPackage()copy-> <Package var>=<Class>.getPackage();
|
ProtectionDomain |
getProtectionDomain()
copy-> .getProtectionDomain()copy-> <ProtectionDomain var>=<Class>.getProtectionDomain();
|
URL |
getResource(String name)
copy-> .getResource( )copy-> <URL var>=<Class>.getResource(<String name>);
|
InputStream |
getResourceAsStream(String name)
copy-> .getResourceAsStream( )copy-> <InputStream var>=<Class>.getResourceAsStream(<String name>);
|
Object[] |
getSigners()
copy-> .getSigners()copy-> <Object var>=<Class>.getSigners();
|
Class |
getSuperclass()
copy-> .getSuperclass()copy-> <Class var>=<Class>.getSuperclass();
|
boolean |
isArray()
copy-> .isArray()copy-> <boolean var>=<Class>.isArray();
|
boolean |
isAssignableFrom(Class cls)
copy-> .isAssignableFrom( )copy-> <boolean var>=<Class>.isAssignableFrom(<Class cls>);
|
boolean |
isInstance(Object obj)
copy-> .isInstance( )copy-> <boolean var>=<Class>.isInstance(<Object obj>);
|
boolean |
isInterface()
copy-> .isInterface()copy-> <boolean var>=<Class>.isInterface();
|
boolean |
isPrimitive()
copy-> .isPrimitive()copy-> <boolean var>=<Class>.isPrimitive();
|
Object |
newInstance()
copy-> .newInstance()copy-> <Object var>=<Class>.newInstance();
|
String |
toString()
copy-> .toString()copy-> <String var>=<Class>.toString();
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |