📄 array.html
字号:
<BR> Creates a new array with the specified component type and dimensions.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#set(java.lang.Object, int, java.lang.Object)">set</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, <A HREF="../../../java/lang/Object.html">Object</A> value)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified new value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setBoolean(java.lang.Object, int, boolean)">setBoolean</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, boolean z)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>boolean</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setByte(java.lang.Object, int, byte)">setByte</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, byte b)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>boolean</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setChar(java.lang.Object, int, char)">setChar</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, char c)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>byte</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setDouble(java.lang.Object, int, double)">setDouble</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, double d)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>double</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setFloat(java.lang.Object, int, float)">setFloat</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, float f)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>float</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setInt(java.lang.Object, int, int)">setInt</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, int i)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>int</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setLong(java.lang.Object, int, long)">setLong</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, long l)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>long</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Array.html#setShort(java.lang.Object, int, short)">setShort</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> array, int index, short s)</CODE><BR> Sets the value of the indexed component of the specified array object to the specified <code>short</code> value.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="newInstance(java.lang.Class, int)"><!-- --></A><H3>newInstance</H3><PRE>public static <A HREF="../../../java/lang/Object.html">Object</A> <B>newInstance</B>(<A HREF="../../../java/lang/Class.html">Class</A> componentType, int length) throws <A HREF="../../../java/lang/NegativeArraySizeException.html">NegativeArraySizeException</A></PRE><DL><DD>Creates a new array with the specified component type and length. Invoking this method is equivalent to creating an array as follows: <blockquote> <pre> int[] x = {length}; Array.newInstance(componentType, x); </pre> </blockquote><DD><DL><DT><B>Parameters:</B><DD><CODE>componentType</CODE> - the <code>Class</code> object representing the component type of the new array<DD><CODE>length</CODE> - the length of the new array<DT><B>Returns:</B><DD>the new array<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified <code>componentType</code> parameter is null<DD><CODE><A HREF="../../../java/lang/NegativeArraySizeException.html">NegativeArraySizeException</A></CODE> - if the specified <code>length</code> is negative</DL></DD></DL><HR><A NAME="newInstance(java.lang.Class, int[])"><!-- --></A><H3>newInstance</H3><PRE>public static <A HREF="../../../java/lang/Object.html">Object</A> <B>newInstance</B>(<A HREF="../../../java/lang/Class.html">Class</A> componentType, int[] dimensions) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/NegativeArraySizeException.html">NegativeArraySizeException</A></PRE><DL><DD>Creates a new array with the specified component type and dimensions. If <code>componentType</code> represents a non-array class or interface, the new array has <code>dimensions.length</code> dimensions and <code>componentType </code> as its component type. If <code>componentType</code> represents an array class, the number of dimensions of the new array is equal to the sum of <code>dimensions.length</code> and the number of dimensions of <code>componentType</code>. In this case, the component type of the new array is the component type of <code>componentType</code>. <p>The number of dimensions of the new array must not exceed the number of array dimensions supported by the implementation (typically 255).<DD><DL><DT><B>Parameters:</B><DD><CODE>componentType</CODE> - the <code>Class</code> object representing the component type of the new array<DD><CODE>dimensions</CODE> - an array of <code>int</code> types representing the dimensions of the new array<DT><B>Returns:</B><DD>the new array<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified <code>componentType</code> argument is null<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified <code>dimensions</code> argument is a zero-dimensional array, or if the number of requested dimensions exceeds the limit on the number of array dimensions supported by the implementation (typically 255).<DD><CODE><A HREF="../../../java/lang/NegativeArraySizeException.html">NegativeArraySizeException</A></CODE> - if any of the components in the specified <code>dimensions</code> argument is negative.</DL></DD></DL><HR><A NAME="getLength(java.lang.Object)"><!-- --></A><H3>getLength</H3><PRE>public static int <B>getLength</B>(<A HREF="../../../java/lang/Object.html">Object</A> array) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></PRE><DL><DD>Returns the length of the specified array object, as an <code>int</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>array</CODE> - the array<DT><B>Returns:</B><DD>the length of the array<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the object argument is not an array</DL></DD></DL><HR><A NAME="get(java.lang.Object, int)"><!-- --></A><H3>get</H3><PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -