Comment | Returned-by | Constructor-argument | Method-argument | Field-type | Type-bound | Links |
Instances of the class Class
represent classes and
interfaces in a running Java application. An enum is a kind of
class and an annotation is a kind of interface. 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()); }
It is also possible to get the Class
object for a named
type (or for void) using a class literal. See Section 15.8.2 of
The Java™ Language Specification.
For example:
System.out.println("The name of class Foo is: "+Foo.class.getName());
implements
<T> | the type of the class modeled by this Class
object. For example, the type of String.class is
Class<String> . Use Class<?> if the class being modeled is
unknown. |
java.lang.ClassLoader.defineClass(byte[], int, int)
java.awt.datatransfer. DataFlavor .getDefaultRepresentationClass ()
+ 2 morejava.awt.image.renderable. ParameterBlock .getParamClasses ()
java.beans. BeanDescriptor .getBeanClass ()
+ 1 morejava.beans. EventSetDescriptor .getListenerType ()
java.beans. IndexedPropertyDescriptor .getIndexedPropertyType ()
java.beans. PropertyDescriptor .getPropertyEditorClass ()
+ 1 morejava.beans.beancontext. BeanContextServiceAvailableEvent .getServiceClass ()
java.beans.beancontext. BeanContextServiceRevokedEvent .getServiceClass ()
java.io. ObjectInputFilter.FilterInfo .serialClass ()
java.io. ObjectInputStream .resolveClass ()
+ 1 morejava.io. ObjectStreamClass .forClass ()
java.io. ObjectStreamField .getType ()
java.lang. Class .asSubclass ()
+ 11 morejava.lang. ClassLoader .defineClass ()
+ 9 morejava.lang. Enum .getDeclaringClass ()
java.lang. EnumConstantNotPresentException .enumType ()
java.lang. Object .getClass ()
java.lang. SecurityManager .getClassContext ()
java.lang. StackWalker .getCallerClass ()
java.lang. StackWalker.StackFrame .getDeclaringClass ()
java.lang.annotation. Annotation .annotationType ()
java.lang.annotation. IncompleteAnnotationException .annotationType ()
java.lang.annotation. Repeatable .value ()
java.lang.instrument. ClassDefinition .getDefinitionClass ()
java.lang.instrument. Instrumentation .getAllLoadedClasses ()
+ 1 morejava.lang.invoke. MethodHandleInfo .getDeclaringClass ()
java.lang.invoke. MethodHandleProxies .wrapperInstanceType ()
java.lang.invoke. MethodHandles.Lookup .accessClass ()
+ 3 morejava.lang.invoke. MethodType .lastParameterType ()
+ 4 morejava.lang.invoke. VarHandle .coordinateTypes ()
+ 1 morejava.lang.management. ManagementFactory .getPlatformManagementInterfaces ()
java.lang.reflect. Constructor .getDeclaringClass ()
+ 2 morejava.lang.reflect. Executable .getDeclaringClass ()
+ 2 morejava.lang.reflect. Field .getDeclaringClass ()
+ 1 morejava.lang.reflect. Member .getDeclaringClass ()
java.lang.reflect. Method .getDeclaringClass ()
+ 3 morejava.lang.reflect. Parameter .getType ()
java.net. SocketOption .type ()
java.net. URLClassLoader .findClass ()
java.nio.file. WatchEvent.Kind .type ()
java.rmi.server. RMIClassLoader .loadClass ()
+ 4 morejava.rmi.server. RMIClassLoaderSpi .loadClass ()
+ 1 morejava.security. SecureClassLoader .defineClass ()
+ 1 morejava.sql. Connection .getTypeMap ()
java.util. IllegalFormatConversionException .getArgumentClass ()
java.util. ServiceLoader.Provider .type ()
javax.activation. ActivationDataFlavor .getRepresentationClass ()
javax.annotation. Resource .type ()
javax.imageio.metadata. IIOMetadataFormat .getObjectClass ()
javax.imageio.metadata. IIOMetadataFormatImpl .getObjectClass ()
javax.imageio.spi. ImageInputStreamSpi .getInputClass ()
javax.imageio.spi. ImageOutputStreamSpi .getOutputClass ()
javax.imageio.spi. ImageReaderSpi .getInputTypes ()
javax.imageio.spi. ImageWriterSpi .getOutputTypes ()
javax.imageio.spi. ServiceRegistry .getCategories ()
javax.management. StandardMBean .getImplementationClass ()
+ 1 morejavax.management.loading. ClassLoaderRepository .loadClass ()
+ 2 morejavax.management.loading. MLet .findClass ()
+ 1 morejavax.print. AttributeException .getUnsupportedAttributes ()
javax.print. PrintService .getSupportedAttributeCategories ()
javax.print.attribute. Attribute .getCategory ()
javax.print.attribute. AttributeSetUtilities .verifyAttributeCategory ()
javax.print.attribute.standard. Chromaticity .getCategory ()
javax.print.attribute.standard. ColorSupported .getCategory ()
javax.print.attribute.standard. Compression .getCategory ()
javax.print.attribute.standard. Copies .getCategory ()
javax.print.attribute.standard. CopiesSupported .getCategory ()
javax.print.attribute.standard. DateTimeAtCompleted .getCategory ()
javax.print.attribute.standard. DateTimeAtCreation .getCategory ()
javax.print.attribute.standard. DateTimeAtProcessing .getCategory ()
javax.print.attribute.standard. Destination .getCategory ()
javax.print.attribute.standard. DialogTypeSelection .getCategory ()
javax.print.attribute.standard. DocumentName .getCategory ()
javax.print.attribute.standard. Fidelity .getCategory ()
javax.print.attribute.standard. Finishings .getCategory ()
javax.print.attribute.standard. JobHoldUntil .getCategory ()
javax.print.attribute.standard. JobImpressions .getCategory ()
javax.print.attribute.standard. JobImpressionsCompleted .getCategory ()
javax.print.attribute.standard. JobImpressionsSupported .getCategory ()
javax.print.attribute.standard. JobKOctets .getCategory ()
javax.print.attribute.standard. JobKOctetsProcessed .getCategory ()
javax.print.attribute.standard. JobKOctetsSupported .getCategory ()
javax.print.attribute.standard. JobMediaSheets .getCategory ()
javax.print.attribute.standard. JobMediaSheetsCompleted .getCategory ()
javax.print.attribute.standard. JobMediaSheetsSupported .getCategory ()
javax.print.attribute.standard. JobMessageFromOperator .getCategory ()
javax.print.attribute.standard. JobName .getCategory ()
javax.print.attribute.standard. JobOriginatingUserName .getCategory ()
javax.print.attribute.standard. JobPriority .getCategory ()
javax.print.attribute.standard. JobPrioritySupported .getCategory ()
javax.print.attribute.standard. JobSheets .getCategory ()
javax.print.attribute.standard. JobState .getCategory ()
javax.print.attribute.standard. JobStateReason .getCategory ()
javax.print.attribute.standard. JobStateReasons .getCategory ()
javax.print.attribute.standard. Media .getCategory ()
javax.print.attribute.standard. MediaPrintableArea .getCategory ()
javax.print.attribute.standard. MediaSize .getCategory ()
javax.print.attribute.standard. MultipleDocumentHandling .getCategory ()
javax.print.attribute.standard. NumberOfDocuments .getCategory ()
javax.print.attribute.standard. NumberOfInterveningJobs .getCategory ()
javax.print.attribute.standard. NumberUp .getCategory ()
javax.print.attribute.standard. NumberUpSupported .getCategory ()
javax.print.attribute.standard. OrientationRequested .getCategory ()
javax.print.attribute.standard. OutputDeviceAssigned .getCategory ()
javax.print.attribute.standard. PDLOverrideSupported .getCategory ()
javax.print.attribute.standard. PageRanges .getCategory ()
javax.print.attribute.standard. PagesPerMinute .getCategory ()
javax.print.attribute.standard. PagesPerMinuteColor .getCategory ()
javax.print.attribute.standard. PresentationDirection .getCategory ()
javax.print.attribute.standard. PrintQuality .getCategory ()
javax.print.attribute.standard. PrinterInfo .getCategory ()
javax.print.attribute.standard. PrinterIsAcceptingJobs .getCategory ()
javax.print.attribute.standard. PrinterLocation .getCategory ()
javax.print.attribute.standard. PrinterMakeAndModel .getCategory ()
javax.print.attribute.standard. PrinterMessageFromOperator .getCategory ()
javax.print.attribute.standard. PrinterMoreInfo .getCategory ()
javax.print.attribute.standard. PrinterMoreInfoManufacturer .getCategory ()
javax.print.attribute.standard. PrinterName .getCategory ()
javax.print.attribute.standard. PrinterResolution .getCategory ()
javax.print.attribute.standard. PrinterState .getCategory ()
javax.print.attribute.standard. PrinterStateReason .getCategory ()
javax.print.attribute.standard. PrinterStateReasons .getCategory ()
javax.print.attribute.standard. PrinterURI .getCategory ()
javax.print.attribute.standard. QueuedJobCount .getCategory ()
javax.print.attribute.standard. ReferenceUriSchemesSupported .getCategory ()
javax.print.attribute.standard. RequestingUserName .getCategory ()
javax.print.attribute.standard. Severity .getCategory ()
javax.print.attribute.standard. SheetCollate .getCategory ()
javax.print.attribute.standard. Sides .getCategory ()
javax.rmi.CORBA. Util .loadClass ()
javax.rmi.CORBA. UtilDelegate .loadClass ()
javax.sound.midi. SoundbankResource .getDataClass ()
javax.sound.sampled. Line.Info .getLineClass ()
javax.sql. RowSet .getTypeMap ()
javax.sql.rowset. BaseRowSet .getTypeMap ()
javax.swing. JTable .getColumnClass ()
javax.swing. UIDefaults .getUIClass ()
+ 1 morejavax.swing.table. AbstractTableModel .getColumnClass ()
javax.swing.table. TableModel .getColumnClass ()
javax.swing.text. DefaultFormatter .getValueClass ()
javax.xml.bind. JAXBElement .getDeclaredType ()
+ 1 morejavax.xml.bind.annotation. XmlAnyElement .value ()
javax.xml.bind.annotation. XmlElement .type ()
javax.xml.bind.annotation. XmlElementDecl .scope ()
javax.xml.bind.annotation. XmlElementRef .type ()
javax.xml.bind.annotation. XmlEnum .value ()
javax.xml.bind.annotation. XmlSchemaType .type ()
javax.xml.bind.annotation. XmlSeeAlso .value ()
javax.xml.bind.annotation. XmlType .factoryClass ()
javax.xml.bind.annotation.adapters. XmlJavaTypeAdapter .type ()
+ 1 morejavax.xml.ws. FaultAction .className ()
javax.xml.ws. WebServiceRef .type ()
+ 1 morejavax.xml.ws.spi. WebServiceFeatureAnnotation .bean ()
java.lang.reflect. Proxy .getProxyClass ()
javax.management. DefaultLoaderRepository .loadClass ()
+ 1 morejavax.management.loading. DefaultLoaderRepository .loadClass ()
+ 1 morejava.rmi.server. LoaderHandler .loadClass ()
+ 1 morejava.awt.datatransfer. DataFlavor ()
java.beans. BeanDescriptor ()
* 3java.beans. EventSetDescriptor ()
* 9java.beans. IndexedPropertyDescriptor ()
* 2java.beans. PropertyDescriptor ()
* 2java.beans.beancontext. BeanContextServiceAvailableEvent ()
java.beans.beancontext. BeanContextServiceRevokedEvent ()
java.io. ObjectStreamField ()
* 2java.lang. EnumConstantNotPresentException ()
java.lang.annotation. IncompleteAnnotationException ()
java.lang.instrument. ClassDefinition ()
java.lang.invoke. SerializedLambda ()
java.util. EnumMap ()
java.util. IllegalFormatConversionException ()
javax.activation. ActivationDataFlavor ()
* 2javax.imageio.spi. ImageInputStreamSpi ()
javax.imageio.spi. ImageOutputStreamSpi ()
javax.imageio.spi. ImageReaderSpi ()
javax.imageio.spi. ImageWriterSpi ()
javax.imageio.spi. ServiceRegistry ()
javax.management. StandardEmitterMBean ()
* 4javax.management. StandardMBean ()
* 4javax.print.attribute. HashAttributeSet ()
* 4javax.sound.midi. Instrument ()
javax.sound.midi. SoundbankResource ()
javax.sound.sampled. DataLine.Info ()
* 3javax.sound.sampled. Line.Info ()
javax.sound.sampled. Port.Info ()
javax.sql.rowset.serial. SQLInputImpl ()
javax.sql.rowset.serial. SerialArray ()
javax.sql.rowset.serial. SerialStruct ()
* 2javax.xml.bind. JAXBElement ()
* 3java.awt. AWTEventMulticaster .getListeners ()
java.awt. Button .getListeners ()
java.awt. Checkbox .getListeners ()
java.awt. CheckboxMenuItem .getListeners ()
java.awt. Choice .getListeners ()
java.awt. Component .getListeners ()
java.awt. Container .getListeners ()
java.awt. List .getListeners ()
java.awt. MenuItem .getListeners ()
java.awt. Scrollbar .getListeners ()
java.awt. TextComponent .getListeners ()
java.awt. TextField .getListeners ()
java.awt. Toolkit .createDragGestureRecognizer ()
java.awt. Window .getListeners ()
java.awt.dnd. DragSource .createDragGestureRecognizer ()
+ 1 morejava.beans. Beans .getInstanceOf ()
+ 1 morejava.beans. DefaultPersistenceDelegate .initialize ()
java.beans. Encoder .getPersistenceDelegate ()
+ 1 morejava.beans. EventHandler .create ()
+ 2 morejava.beans. Introspector .flushFromCaches ()
+ 6 morejava.beans. PersistenceDelegate .initialize ()
java.beans. PropertyDescriptor .setPropertyEditorClass ()
java.beans. PropertyEditorManager .findEditor ()
+ 2 morejava.beans.beancontext. BeanContextServiceProvider .getCurrentServiceSelectors ()
+ 1 morejava.beans.beancontext. BeanContextServiceRevokedEvent .isServiceClass ()
java.beans.beancontext. BeanContextServices .addService ()
+ 4 morejava.beans.beancontext. BeanContextServicesSupport .addService ()
+ 8 morejava.beans.beancontext. BeanContextServicesSupport.BCSSProxyServiceProvider .getCurrentServiceSelectors ()
+ 1 morejava.beans.beancontext. BeanContextSupport .classEquals ()
+ 1 morejava.io. ObjectOutputStream .annotateClass ()
+ 1 morejava.io. ObjectStreamClass .lookup ()
+ 1 morejava.lang. Class .asSubclass ()
+ 10 morejava.lang. ClassLoader .resolveClass ()
+ 1 morejava.lang. ClassValue .computeValue ()
+ 2 morejava.lang. Enum .valueOf ()
java.lang. Module .addUses ()
+ 2 morejava.lang. Package .getAnnotation ()
+ 4 morejava.lang.instrument. ClassFileTransformer .transform ()
+ 1 morejava.lang.instrument. Instrumentation .isModifiableClass ()
+ 3 morejava.lang.invoke. MethodHandle .asCollector ()
+ 4 morejava.lang.invoke. MethodHandleInfo .reflectAs ()
+ 1 morejava.lang.invoke. MethodHandleProxies .asInterfaceInstance ()
java.lang.invoke. MethodHandles .arrayConstructor ()
+ 17 morejava.lang.invoke. MethodHandles.Lookup .accessClass ()
+ 19 morejava.lang.invoke. MethodType .appendParameterTypes ()
+ 16 morejava.lang.management. ManagementFactory .getPlatformMXBean ()
+ 4 morejava.lang.reflect. AccessibleObject .getAnnotation ()
+ 4 morejava.lang.reflect. AnnotatedElement .getAnnotation ()
+ 4 morejava.lang.reflect. Array .newInstance ()
+ 1 morejava.lang.reflect. Constructor .getAnnotation ()
java.lang.reflect. Executable .getAnnotation ()
+ 1 morejava.lang.reflect. Field .getAnnotation ()
+ 1 morejava.lang.reflect. Method .getAnnotation ()
java.lang.reflect. Parameter .getAnnotation ()
+ 3 morejava.lang.reflect. Proxy .isProxyClass ()
+ 2 morejava.net. ContentHandler .getContent ()
java.net. URL .getContent ()
java.net. URLConnection .getContent ()
java.nio.file. FileStore .getFileStoreAttributeView ()
+ 1 morejava.nio.file. Files .getFileAttributeView ()
+ 1 morejava.nio.file. SecureDirectoryStream .getFileAttributeView ()
+ 1 morejava.nio.file.spi. FileSystemProvider .getFileAttributeView ()
+ 1 morejava.rmi.server. RMIClassLoader .getClassAnnotation ()
java.rmi.server. RMIClassLoaderSpi .getClassAnnotation ()
java.security. AlgorithmParameters .getParameterSpec ()
java.security. AlgorithmParametersSpi .engineGetParameterSpec ()
java.security. KeyFactory .getKeySpec ()
java.security. KeyFactorySpi .engineGetKeySpec ()
java.security. KeyStore .entryInstanceOf ()
java.security. KeyStoreSpi .engineEntryInstanceOf ()
java.sql. Array .getArray ()
+ 3 morejava.sql. CallableStatement .getObject ()
+ 3 morejava.sql. Connection .setTypeMap ()
java.sql. Ref .getObject ()
java.sql. ResultSet .getObject ()
+ 3 morejava.sql. SQLInput .readObject ()
java.sql. SQLXML .getSource ()
+ 1 morejava.sql. Struct .getAttributes ()
java.sql. Wrapper .isWrapperFor ()
+ 1 morejava.util. Arrays .copyOf ()
+ 1 morejava.util. Collections .checkedCollection ()
+ 11 morejava.util. EnumSet .allOf ()
+ 1 morejava.util. ServiceLoader .load ()
+ 3 morejava.util.concurrent.atomic. AtomicIntegerFieldUpdater .newUpdater ()
java.util.concurrent.atomic. AtomicLongFieldUpdater .newUpdater ()
java.util.concurrent.atomic. AtomicReferenceFieldUpdater .newUpdater ()
+ 1 morejava.util.prefs. Preferences .systemNodeForPackage ()
+ 1 morejavax.annotation.processing. RoundEnvironment .getElementsAnnotatedWith ()
+ 1 morejavax.crypto. SecretKeyFactory .getKeySpec ()
javax.crypto. SecretKeyFactorySpi .engineGetKeySpec ()
javax.imageio.metadata. IIOMetadataFormatImpl .addObjectValue ()
+ 3 morejavax.imageio.spi. IIOServiceProvider .onDeregistration ()
+ 1 morejavax.imageio.spi. RegisterableService .onDeregistration ()
+ 1 morejavax.imageio.spi. ServiceRegistry .deregisterAll ()
+ 9 morejavax.lang.model. AnnotatedConstruct .getAnnotation ()
+ 1 morejavax.lang.model.element. Element .getAnnotation ()
javax.management. JMX .isMXBeanInterface ()
+ 4 morejavax.management. MBeanServerInvocationHandler .newProxyInstance ()
javax.management.openmbean. ArrayType .getPrimitiveArrayType ()
javax.naming.spi. Resolver .resolveToClass ()
+ 1 morejavax.print. PrintService .getAttribute ()
+ 3 morejavax.print.attribute. AttributeSet .containsKey ()
+ 2 morejavax.print.attribute. AttributeSetUtilities .verifyAttributeCategory ()
+ 2 morejavax.print.attribute. HashAttributeSet .containsKey ()
+ 2 morejavax.rmi.CORBA. PortableRemoteObjectDelegate .narrow ()
javax.rmi.CORBA. Util .getCodebase ()
javax.rmi.CORBA. UtilDelegate .getCodebase ()
javax.rmi.CORBA. ValueHandler .getRMIRepositoryID ()
+ 2 morejavax.rmi. PortableRemoteObject .narrow ()
javax.script. Invocable .getInterface ()
+ 1 morejavax.security.auth. Subject .getPrincipals ()
+ 2 morejavax.sql. RowSet .setTypeMap ()
javax.sql.rowset. BaseRowSet .setTypeMap ()
javax.sql.rowset. RowSetMetaDataImpl .isWrapperFor ()
+ 1 morejavax.sql.rowset.serial. SerialArray .getArray ()
+ 3 morejavax.sql.rowset.serial. SerialRef .getObject ()
javax.sql.rowset.serial. SerialStruct .getAttributes ()
javax.swing. AbstractListModel .getListeners ()
javax.swing. AbstractSpinnerModel .getListeners ()
javax.swing. DefaultBoundedRangeModel .getListeners ()
javax.swing. DefaultButtonModel .getListeners ()
javax.swing. DefaultListSelectionModel .getListeners ()
javax.swing. DefaultSingleSelectionModel .getListeners ()
javax.swing. JComponent .getListeners ()
javax.swing. JTable .getDefaultEditor ()
+ 3 morejavax.swing. LookAndFeel .makeIcon ()
javax.swing. SwingUtilities .getAncestorOfClass ()
javax.swing. Timer .getListeners ()
javax.swing.event. EventListenerList .add ()
+ 3 morejavax.swing.plaf.synth. SynthLookAndFeel .load ()
javax.swing.table. AbstractTableModel .getListeners ()
javax.swing.table. DefaultTableColumnModel .getListeners ()
javax.swing.text. AbstractDocument .getListeners ()
javax.swing.text. DefaultCaret .getListeners ()
javax.swing.text. DefaultFormatter .setValueClass ()
javax.swing.text. StyleContext.NamedStyle .getListeners ()
javax.swing.tree. DefaultTreeModel .getListeners ()
javax.swing.tree. DefaultTreeSelectionModel .getListeners ()
javax.tools. DocumentationTool .getTask ()
javax.tools. ForwardingJavaFileManager .getServiceLoader ()
javax.tools. JavaFileManager .getServiceLoader ()
javax.xml.bind. Binder .unmarshal ()
javax.xml.bind. JAXB .unmarshal ()
+ 6 morejavax.xml.bind. JAXBContext .createBinder ()
+ 2 morejavax.xml.bind. JAXBContextFactory .createContext ()
javax.xml.bind. Marshaller .getAdapter ()
+ 1 morejavax.xml.bind. Unmarshaller .getAdapter ()
+ 5 morejavax.xml.bind.helpers. AbstractMarshallerImpl .getAdapter ()
+ 1 morejavax.xml.bind.helpers. AbstractUnmarshallerImpl .getAdapter ()
+ 5 morejavax.xml.ws. BindingProvider .getEndpointReference ()
javax.xml.ws. Endpoint .getEndpointReference ()
javax.xml.ws. EndpointReference .getPort ()
javax.xml.ws. Service .createDispatch ()
+ 7 morejavax.xml.ws. WebServiceContext .getEndpointReference ()
javax.xml.ws.spi. Provider .createEndpoint ()
+ 3 morejavax.xml.ws.spi. ServiceDelegate .createDispatch ()
+ 7 morejavax.xml.xpath. XPath .evaluateExpression ()
+ 1 morejavax.xml.xpath. XPathEvaluationResult.XPathResultType .getQNameType ()
javax.xml.xpath. XPathExpression .evaluateExpression ()
+ 1 morejava.awt. AWTKeyStroke .registerSubclass ()
java.lang. SecurityManager .checkMemberAccess ()
java.lang. Compiler .compileClass ()
java.beans.beancontext. BeanContextServiceAvailableEvent .serviceClass
java.beans.beancontext. BeanContextServiceRevokedEvent .serviceClass
java.lang. Boolean .TYPE
java.lang. Byte .TYPE
java.lang. Character .TYPE
java.lang. Double .TYPE
java.lang. Float .TYPE
java.lang. Integer .TYPE
java.lang. Long .TYPE
java.lang. Short .TYPE
java.lang. Void .TYPE
javax.imageio.spi. ImageInputStreamSpi .inputClass
javax.imageio.spi. ImageOutputStreamSpi .outputClass
javax.imageio.spi. ImageReaderSpi .inputTypes
javax.imageio.spi. ImageWriterSpi .outputTypes
javax.xml.bind. JAXBElement .declaredType
+ 1 morejavax.imageio.spi. ImageReaderSpi .STANDARD_INPUT_TYPE
javax.imageio.spi. ImageWriterSpi .STANDARD_OUTPUT_TYPE