📄 constructor.html
字号:
<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 name of this constructor, as a string. This is always the same as the simple name of the constructor's declaring class.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../java/lang/reflect/Member.html#getName()">getName</A></CODE> in interface <CODE><A HREF="../../../java/lang/reflect/Member.html">Member</A></CODE></DL></DD></DL><HR><A NAME="getModifiers()"><!-- --></A><H3>getModifiers</H3><PRE>public int <B>getModifiers</B>()</PRE><DL><DD>Returns the Java language modifiers for the constructor represented by this <code>Constructor</code> object, as an integer. The <code>Modifier</code> class should be used to decode the modifiers.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../java/lang/reflect/Member.html#getModifiers()">getModifiers</A></CODE> in interface <CODE><A HREF="../../../java/lang/reflect/Member.html">Member</A></CODE></DL></DD><DD><DL><DT><B>See Also: </B><DD><A HREF="../../../java/lang/reflect/Modifier.html"><CODE>Modifier</CODE></A></DL></DD></DL><HR><A NAME="getParameterTypes()"><!-- --></A><H3>getParameterTypes</H3><PRE>public <A HREF="../../../java/lang/Class.html">Class</A>[] <B>getParameterTypes</B>()</PRE><DL><DD>Returns an array of <code>Class</code> objects that represent the formal parameter types, in declaration order, of the constructor represented by this <code>Constructor</code> object. Returns an array of length 0 if the underlying constructor takes no parameters.<DD><DL></DL></DD></DL><HR><A NAME="getExceptionTypes()"><!-- --></A><H3>getExceptionTypes</H3><PRE>public <A HREF="../../../java/lang/Class.html">Class</A>[] <B>getExceptionTypes</B>()</PRE><DL><DD>Returns an array of <code>Class</code> objects that represent the types of of exceptions declared to be thrown by the underlying constructor represented by this <code>Constructor</code> object. Returns an array of length 0 if the constructor declares no exceptions in its <code>throws</code> clause.<DD><DL></DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj)</PRE><DL><DD>Compares this <code>Constructor</code> against the specified object. Returns true if the objects are the same. Two <code>Constructor</code> objects are the same if they were declared by the same class and have the same formal parameter types.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../../java/lang/Object.html">Object</A></CODE></DL></DD><DD>Following copied from class: <CODE>java.lang.Object</CODE></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - the reference object with which to compare.<DT><B>Returns:</B><DD><code>true</code> if this object is the same as the obj argument; <code>false</code> otherwise.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/Boolean.html#hashCode()"><CODE>Boolean.hashCode()</CODE></A>, <A HREF="../../../java/util/Hashtable.html"><CODE>Hashtable</CODE></A></DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD>Returns a hashcode for this <code>Constructor</code>. The hashcode is the same as the hashcode for the underlying constructor's declaring class name.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../../java/lang/Object.html">Object</A></CODE></DL></DD><DD>Following copied from class: <CODE>java.lang.Object</CODE></DD><DD><DL><DT><B>Returns:</B><DD>a hash code value for this object.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/Object.html#equals(java.lang.Object)"><CODE>Object.equals(java.lang.Object)</CODE></A>, <A HREF="../../../java/util/Hashtable.html"><CODE>Hashtable</CODE></A></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../../java/lang/String.html">String</A> <B>toString</B>()</PRE><DL><DD>Returns a string describing this <code>Constructor</code>. The string is formatted as the constructor access modifiers, if any, followed by the fully-qualified name of the declaring class, followed by a parenthesized, comma-separated list of the constructor's formal parameter types. For example: <pre> public java.util.Hashtable(int,float) </pre> <p>The only possible modifiers for constructors are the access modifiers <tt>public</tt>, <tt>protected</tt> or <tt>private</tt>. Only one of these may appear, or none if the constructor has default (package) access.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../../java/lang/Object.html">Object</A></CODE></DL></DD><DD>Following copied from class: <CODE>java.lang.Object</CODE></DD><DD><DL><DT><B>Returns:</B><DD>a string representation of the object.</DL></DD></DL><HR><A NAME="newInstance(java.lang.Object[])"><!-- --></A><H3>newInstance</H3><PRE>public <A HREF="../../../java/lang/Object.html">Object</A> <B>newInstance</B>(<A HREF="../../../java/lang/Object.html">Object</A>[] initargs) throws <A HREF="../../../java/lang/InstantiationException.html">InstantiationException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A>, <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/reflect/InvocationTargetException.html">InvocationTargetException</A></PRE><DL><DD>Uses the constructor represented by this <code>Constructor</code> object to create and initialize a new instance of the constructor's declaring class, with the specified initialization parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to method invocation conversions as necessary. Returns the newly created and initialized object. <p>Creation proceeds with the following steps, in order: <p>If the class that declares the underlying constructor represents an abstract class, the creation throws an <code>InstantiationException</code>. <p>If this <code>Constructor</code> object enforces Java language access control and the underlying constructor is inaccessible, the creation throws an <code>IllegalAccessException</code>. <p>If the number of actual parameters supplied via <code>initargs</code> is different from the number of formal parameters required by the underlying constructor, the creation throws an <code>IllegalArgumentException</code>. <p>A new instance of the constructor's declaring class is created, and its fields are initialized to their default initial values. <p>For each actual parameter in the supplied <code>initargs</code> array: <p>If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of the primitive type. If this attempt fails, the creation throws an <code>IllegalArgumentException</code>. <p>If, after possible unwrapping, the parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion, the creation throws an <code>IllegalArgumentException</code>. <p> The constructor's declaring class is initialized if it has not already been initialized. A new instance of the constructor's declaring class is created, and its fields are initialized to their default initial values. <p>Control transfers to the underlying constructor to initialize the new instance. If the constructor completes abruptly by throwing an exception, the exception is placed in an <code>InvocationTargetException</code> and thrown in turn to the caller of <code>newInstance</code>. <p>If the constructor completes normally, returns the newly created and initialized instance.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor is inaccessible.<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the number of actual and formal parameters differ, or if an unwrapping or method invocation conversion fails.<DD><CODE><A HREF="../../../java/lang/InstantiationException.html">InstantiationException</A></CODE> - if the class that declares the underlying constructor represents an abstract class.<DD><CODE><A HREF="../../../java/lang/reflect/InvocationTargetException.html">InvocationTargetException</A></CODE> - if the underlying constructor throws an exception.<DD><CODE><A HREF="../../../java/lang/ExceptionInInitializerError.html">ExceptionInInitializerError</A></CODE> - if the initialization provoked by this method fails.</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/Constructor.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/reflect/Array.html"><B>PREV CLASS</B></A> <A HREF="../../../java/lang/reflect/Field.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="Constructor.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="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -