class.html
来自「API資料大全」· HTML 代码 · 共 1,325 行 · 第 1/5 页
HTML
1,325 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:00 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Class</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Class.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/lang/Character.UnicodeBlock.html"><B>PREV CLASS</B></A> <A HREF="../../java/lang/ClassLoader.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Class.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.lang</FONT><BR>Class Class</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.lang.Class</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public final class <B>Class</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A><DT>implements <A HREF="../../java/io/Serializable.html">Serializable</A></DL><P>Instances of the class <code>Class</code> represent classes and interfaces in a running Java application. Every array also belongs to a class that is reflected as a <code>Class</code> object that is shared by all arrays with the same element type and number of dimensions. The primitive Java types (<code>boolean</code>, <code>byte</code>, <code>char</code>, <code>short</code>, <code>int</code>, <code>long</code>, <code>float</code>, and <code>double</code>), and the keyword <code>void</code> are also represented as <code>Class</code> objects. <p> <code>Class</code> has no public constructor. Instead <code>Class</code> objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the <code>defineClass</code> method in the class loader. <p> The following example uses a <code>Class</code> object to print the class name of an object: <p> <blockquote><pre> void printClassName(Object obj) { System.out.println("The class of " + obj + " is " + obj.getClass().getName()); } </pre></blockquote><P><DL><DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/ClassLoader.html#defineClass(byte[], int, int)"><CODE>ClassLoader.defineClass(byte[], int, int)</CODE></A>, <A HREF="../../serialized-form.html#java.lang.Class">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/Class.html">Class</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#forName(java.lang.String)">forName</A></B>(<A HREF="../../java/lang/String.html">String</A> className)</CODE><BR> Returns the <code>Class</code> object associated with the class or interface with the given string name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/Class.html">Class</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#forName(java.lang.String, boolean, java.lang.ClassLoader)">forName</A></B>(<A HREF="../../java/lang/String.html">String</A> name, boolean initialize, <A HREF="../../java/lang/ClassLoader.html">ClassLoader</A> loader)</CODE><BR> Returns the <code>Class</code> object associated with the class or interface with the given string name, using the given class loader.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Class.html">Class</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getClasses()">getClasses</A></B>()</CODE><BR> Returns an array containing <code>Class</code> objects representing all the public classes and interfaces that are members of the class represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/ClassLoader.html">ClassLoader</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getClassLoader()">getClassLoader</A></B>()</CODE><BR> Returns the class loader for the class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Class.html">Class</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getComponentType()">getComponentType</A></B>()</CODE><BR> Returns the <code>Class</code> representing the component type of an array.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Constructor.html">Constructor</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getConstructor(java.lang.Class[])">getConstructor</A></B>(<A HREF="../../java/lang/Class.html">Class</A>[] parameterTypes)</CODE><BR> Returns a <code>Constructor</code> object that reflects the specified public constructor of the class represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Constructor.html">Constructor</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getConstructors()">getConstructors</A></B>()</CODE><BR> Returns an array containing <code>Constructor</code> objects reflecting all the public constructors of the class represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Class.html">Class</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaredClasses()">getDeclaredClasses</A></B>()</CODE><BR> Returns an array of <code>Class</code> objects reflecting all the classes and interfaces declared as members of the class represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Constructor.html">Constructor</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaredConstructor(java.lang.Class[])">getDeclaredConstructor</A></B>(<A HREF="../../java/lang/Class.html">Class</A>[] parameterTypes)</CODE><BR> Returns a <code>Constructor</code> object that reflects the specified constructor of the class or interface represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Constructor.html">Constructor</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaredConstructors()">getDeclaredConstructors</A></B>()</CODE><BR> Returns an array of <code>Constructor</code> objects reflecting all the constructors declared by the class represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Field.html">Field</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaredField(java.lang.String)">getDeclaredField</A></B>(<A HREF="../../java/lang/String.html">String</A> name)</CODE><BR> Returns a <code>Field</code> object that reflects the specified declared field of the class or interface represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Field.html">Field</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaredFields()">getDeclaredFields</A></B>()</CODE><BR> Returns an array of <code>Field</code> objects reflecting all the fields declared by the class or interface represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Method.html">Method</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaredMethod(java.lang.String, java.lang.Class[])">getDeclaredMethod</A></B>(<A HREF="../../java/lang/String.html">String</A> name, <A HREF="../../java/lang/Class.html">Class</A>[] parameterTypes)</CODE><BR> Returns a <code>Method</code> object that reflects the specified declared method of the class or interface represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/reflect/Method.html">Method</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaredMethods()">getDeclaredMethods</A></B>()</CODE><BR> Returns an array of <code>Method</code> objects reflecting all the methods declared by the class or interface represented by this <code>Class</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Class.html">Class</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Class.html#getDeclaringClass()">getDeclaringClass</A></B>()</CODE><BR> If the class or interface represented by this <code>Class</code> object
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?