java.lang · java.base · since Java 1.0
Class
public final class Class<T>
implements Type, AnnotatedElement, GenericDeclarationThe runtime representation of a type — the entry point to reflection and a type-safe token (Class<T>) for APIs like cast() and typesafe heterogeneous containers.
Key methods
static Class<?> forName(String name) | Load (and by default initialize) a class by binary name. |
Method[] getDeclaredMethods() / Field[] getDeclaredFields() | All members declared here (any visibility). |
Constructor<T> getDeclaredConstructor(Class<?>...) | Reflective instantiation entry. |
T cast(Object obj) | Checked dynamic cast — the type-token workhorse (EJ 33). |
boolean isInstance(Object) / isAssignableFrom(Class) | Dynamic instanceof / subtype tests. |
<A extends Annotation> A getAnnotation(Class<A>) | Read runtime-retained annotations. |
boolean isRecord() / isSealed() / isEnum() | Modern type-kind tests. |