- ✕This summary was generated using AI based on multiple online sources. To view the original source information, use the "Learn more" links.
The Class class in Java, part of the java.lang package, represents classes and interfaces in a running Java application. Instances of this class are created automatically by the Java Virtual Machine (JVM) and are used extensively in the Reflection API. The Class class provides various methods to get information about the class or interface it represents, such as its name, superclass, interfaces, fields, and methods.
Commonly Used Methods
Here are some commonly used methods of the Class class:
getName(): Returns the name of the class or interface represented by this Class object.
getSimpleName(): Returns the simple name of the class or interface represented by this Class object.
getSuperclass(): Returns the superclass of the class represented by this Class object.
getInterfaces(): Returns an array of interfaces implemented by the class or interface represented by this Class object.
getField(String name): Returns a Field object that represents the public field with the specified name in the class or interface represented by this Class object.
getMethod(String name, Class<?>... parameterTypes): Returns a Method object that represents the public method with the specified name and parameter types in the class or interface represented by this Class object.
newInstance(): Creates a new instance of the class represented by this Class object using its default constructor.
isInstance(Object obj): Returns true if the specified object is an instance of the class or interface represented by this Class object, false otherwise.
isAssignableFrom(Class<?> cls): Returns true if this Class object is assignable from the specified Class object, false otherwise.
Class (Java Platform SE 8 ) - Oracle
Learn how to use the Class class to represent classes and interfaces in a running Java application. See the methods, constructors, and fields of the Class class and their descriptions.
See results only from docs.oracle.comUse
Uses of Class java.lang.ClassUses of …
TypeVariable
TypeVariable is the common …
Frames
java.applet java.awt java.awt.color …
GenericSignatureFormatError
Methods inherited from class java.lang. …
ProtectionDomain
The ProtectionDomain class …
Annotation
The hash code of a string, enum, class, or …
Field
A Field provides information about, and …
Overview
Java™ Platform, Standard Edition 8 API …
ParameterizedType
ParameterizedType represents a …
Modifier
The Modifier class provides static …
Java.lang.Class class in Java | Set 1 - Set 1 - GeeksforGeeks
Mar 14, 2023 · In Java, the java.lang.Class class is a built-in class that represents a class or interface at runtime. It contains various methods that provide information about the class or interface, such as its …
Java Class Class - Complete Tutorial with Examples - ZetCode
Apr 13, 2025 · The java.lang.Class class represents the runtime representation of classes and interfaces in a Java application. It serves as the entry point for reflection operations, allowing programmers to …
What is the use of java.lang.Class in Java? Example
Aug 4, 2025 · java.lang.Class is one of the most important classes in java but mostly overlooked by Java developers. It is very useful in the sense that it provides several utility methods like getClass (), …
java.lang.Class class - Online Tutorials Library
58 rows · The java.lang.Class class instance represent classes and interfaces in a running Java …
See all 58 rows on www.tutorialspoint.comSR.NO. METHOD & DESCRIPTION 1 <U> Class<? extends U> asSubclass ... 2 T cast (Object obj) This method casts an ... 3 boolean desiredAssertionStatus () This ... 4 static Class<?> forName (String ...
Code sample
public static void show(Class cls) {System.out.println("Class = " + cls.getName());Class[] c = cls.getClasses();System.out.println("Classes = " + Arrays.asList(c));Class[] i = cls.getInterfaces();...java.lang.Class class in Java - Tpoint Tech
The java.lang.Class class serves as a fundamental element of Java's Reflective Application Programming Interface (API), enabling software engineers to examine and modify classes through …
what is the Class object (java.lang.Class)? - Stack Overflow
Jun 20, 2014 · The Java documentation for Class says: Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class …
What Is java.lang.Class Class - Herong's Tutorial Examples
What Is java.lang.Class Class? java.lang.Class is a built-in class that represent instances of all data types used in a Java application in the JVM. Instances of classes, interfaces, enumerations, …
java.lang (Java Platform SE 8 ) - Oracle
38 rows · Provides classes that are fundamental to the design of the Java programming language. The most important classes are Object, which is the root of the class hierarchy, and Class, instances of …
Mastering the `java.lang` Package: A Comprehensive Guide
Nov 12, 2025 · The java.lang package is one of the most fundamental and widely used packages in the Java programming language. It is automatically imported into every Java program, which means you …