📄 class.html
字号:
forName</H3>
<PRE>
public static <A HREF="../../java/lang/Class.html">Class</A> <B>forName</B>(<A HREF="../../java/lang/String.html">String</A> className) throws <A HREF="../../java/lang/ClassNotFoundException.html">ClassNotFoundException</A></PRE>
<DL>
<DD>Returns the <code>Class</code> object associated with the class with the given string name. Given the fully-qualified name for a class or interface, this method attempts to locate, load and link the class. If it succeeds, returns the Class object representing the class. If it fails, the method throws a ClassNotFoundException. <p> For example, the following code fragment returns the runtime <code>Class</code> descriptor for the class named <code>java.lang.Thread</code>: <ul><code> Class t = Class.forName("java.lang.Thread") </code></ul><DD><DL>
<DT><B>Parameters:</B><DD><CODE>className</CODE> - the fully qualified name of the desired class.<DT><B>Returns:</B><DD>the <code>Class</code> descriptor for the class with the specified name.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassNotFoundException.html">ClassNotFoundException</A></CODE> - if the class could not be found.<DT><B>Since: </B><DD>JDK1.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="newInstance()"><!-- --></A><H3>
newInstance</H3>
<PRE>
public <A HREF="../../java/lang/Object.html">Object</A> <B>newInstance</B>() throws <A HREF="../../java/lang/InstantiationException.html">InstantiationException</A>, <A HREF="../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE>
<DL>
<DD>Creates a new instance of a class.<DD><DL>
<DT><B>Returns:</B><DD>a newly allocated instance of the class represented by this object. This is done exactly as if by a <code>new</code> expression with an empty argument list.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the class or initializer is not accessible.<DD><CODE><A HREF="../../java/lang/InstantiationException.html">InstantiationException</A></CODE> - if an application tries to instantiate an abstract class or an interface, or if the instantiation fails for some other reason.<DT><B>Since: </B><DD>JDK1.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isInstance(java.lang.Object)"><!-- --></A><H3>
isInstance</H3>
<PRE>
public boolean <B>isInstance</B>(<A HREF="../../java/lang/Object.html">Object</A> obj)</PRE>
<DL>
<DD>Determines if the specified <code>Object</code> is assignment-compatible with the object represented by this <code>Class</code>. This method is the dynamic equivalent of the Java language <code>instanceof</code> operator. The method returns <code>true</code> if the specified <code>Object</code> argument is non-null and can be cast to the reference type represented by this <code>Class</code> object without raising a <code>ClassCastException.</code> It returns <code>false</code> otherwise. <p> Specifically, if this <code>Class</code> object represents a declared class, this method returns <code>true</code> if the specified <code>Object</code> argument is an instance of the represented class (or of any of its subclasses); it returns <code>false</code> otherwise. If this <code>Class</code> object represents an array class, this method returns <code>true</code> if the specified <code>Object</code> argument can be converted to an object of the array class by an identity conversion or by a widening reference conversion; it returns <code>false</code> otherwise. If this <code>Class</code> object represents an interface, this method returns <code>true</code> if the class or any superclass of the specified <code>Object</code> argument implements this interface; it returns <code>false</code> otherwise. If this <code>Class</code> object represents a primitive type, this method returns <code>false</code>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object to check<DT><B>Returns:</B><DD>true if <code>obj</code> is an instance of this class<DT><B>Since: </B><DD>JDK1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isAssignableFrom(java.lang.Class)"><!-- --></A><H3>
isAssignableFrom</H3>
<PRE>
public boolean <B>isAssignableFrom</B>(<A HREF="../../java/lang/Class.html">Class</A> cls)</PRE>
<DL>
<DD>Determines if the class or interface represented by this <code>Class</code> object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified <code>Class</code> parameter. It returns <code>true</code> if so; otherwise it returns <code>false</code>. If this <code>Class</code> object represents a primitive type, this method returns <code>true</code> if the specified <code>Class</code> parameter is exactly this <code>Class</code> object; otherwise it returns <code>false</code>. <p> Specifically, this method tests whether the type represented by the specified <code>Class</code> parameter can be converted to the type represented by this <code>Class</code> object via an identity conversion or via a widening reference conversion. See <em>The Java Language Specification</em>, sections 5.1.1 and 5.1.4 , for details.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cls</CODE> - the <code>Class</code> object to be checked<DT><B>Returns:</B><DD>the <code>boolean</code> value indicating whether objects of the type <code>cls</code> can be assigned to objects of this class<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified Class parameter is null.<DT><B>Since: </B><DD>JDK1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isInterface()"><!-- --></A><H3>
isInterface</H3>
<PRE>
public boolean <B>isInterface</B>()</PRE>
<DL>
<DD>Determines if the specified <code>Class</code> object represents an interface type.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if this object represents an interface; <code>false</code> otherwise.</DL>
</DD>
</DL>
<HR>
<A NAME="isArray()"><!-- --></A><H3>
isArray</H3>
<PRE>
public boolean <B>isArray</B>()</PRE>
<DL>
<DD>Determines if this <code>Class</code> object represents an array class.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if this object represents an array class; <code>false</code> otherwise.<DT><B>Since: </B><DD>JDK1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getName()"><!-- --></A><H3>
getName</H3>
<PRE>
public <A HREF="../../java/lang/String.html">String</A> <B>getName</B>()</PRE>
<DL>
<DD>Returns the fully-qualified name of the entity (class, interface, array class, primitive type, or void) represented by this <code>Class</code> object, as a <code>String</code>. <p> If this <code>Class</code> object represents a class of arrays, then the internal form of the name consists of the name of the element type in Java signature format, preceded by one or more "<tt>[</tt>" characters representing the depth of array nesting. Thus: <blockquote><pre> (new Object[3]).getClass().getName() </pre></blockquote> returns "<code>[Ljava.lang.Object;</code>" and: <blockquote><pre> (new int[3][4][5][6][7][8][9]).getClass().getName() </pre></blockquote> returns "<code>[[[[[[[I</code>". The encoding of element type names is as follows: <blockquote><pre> B byte C char D double F float I int J long L<i>classname;</i> class or interface S short Z boolean </pre></blockquote> The class or interface name <tt><i>classname</i></tt> is given in fully qualified form as shown in the example above.<DD><DL>
<DT><B>Returns:</B><DD>the fully qualified name of the class or interface represented by this object.</DL>
</DD>
</DL>
<HR>
<A NAME="getResourceAsStream(java.lang.String)"><!-- --></A><H3>
getResourceAsStream</H3>
<PRE>
public <A HREF="../../java/io/InputStream.html">InputStream</A> <B>getResourceAsStream</B>(<A HREF="../../java/lang/String.html">String</A> name)</PRE>
<DL>
<DD>Finds a resource with a given name. This method returns null if no resource with this name is found. The rules for searching resources associated with a given class are profile specific.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - name of the desired resource<DT><B>Returns:</B><DD>a <code>java.io.InputStream</code> object.<DT><B>Since: </B><DD>JDK1.1</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_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-all.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>
<strong>MID Profile</strong></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/lang/Character.html"><B>PREV CLASS</B></A>
<A HREF="../../java/lang/Integer.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>
<font size="-1"><a href="mailto:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -