⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 javalang.doc17.html

📁 java语言规范
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<a name="5966"></a>
<p><font size=+1><strong>20.18.10   </strong> <code>public static String <code><b>getProperty</b></code>(String key,<br> &#32; &#32; &#32;String defaults)<br>throws SecurityException</code></font>
<p>
<a name="6401"></a>
First, if there is a security manager, its <code>checkPropertyAccess</code> method 
<a href="javalang.doc16.html#29883">(&#167;20.17.16)</a> is called with the <code>key</code> as its argument.
<p><a name="6536"></a>
If there is no current set of system properties, a set of system properties is first created and initialized in the same manner as for the <code>getProperties</code> method <a href="javalang.doc17.html#6014">(&#167;20.18.7)</a>.<p>
<a name="6547"></a>
The system property value associated with the specified <code>key</code> string is returned. If there is no property with that key, then the argument <code>defaults</code> is returned.<p>
<a name="14142"></a>
<p><font size=+1><strong>20.18.11   </strong> <code>public static void <code><b>exit</b></code>(int status)<br>throws SecurityException</code></font>
<p>
<a name="6215"></a>
This method terminates the currently running Java Virtual Machine. The argument 
serves as a status code; by convention, a nonzero status code indicates abnormal 
termination.
<p><a name="6735"></a>
This method never returns normally.<p>
<a name="6216"></a>
The call <code>System.exit(n)</code> is effectively equivalent to the call:<p>
<pre><a name="6228"></a>Runtime.getRuntime().exit(n)
</pre><a name="6221"></a>
For a more complete description, see the <code>exit</code> method of class <code>Runtime</code> 
<a href="javalang.doc15.html#34351">(&#167;20.16.2)</a>.
<p><a name="14143"></a>
<p><font size=+1><strong>20.18.12   </strong> <code>public static void <code><b>gc</b></code>()</code></font>
<p>
<a name="6233"></a>
Calling this method suggests that the Java Virtual Machine expend effort toward 
recycling discarded objects in order to make the memory they currently occupy 
available for quick reuse. When control returns from the method call, the Java Virtual
Machine has made a best effort to recycle all discarded objects.
<p><a name="6234"></a>
The call <code>System.gc()</code> is effectively equivalent to the call:<p>
<pre><a name="6235"></a>Runtime.getRuntime().gc()
</pre><a name="6239"></a>
For a more complete description, see the <code>gc</code> method of class <code>Runtime</code> <a href="javalang.doc15.html#14090">(&#167;20.16.9)</a>.
<p><a name="14144"></a>
<p><font size=+1><strong>20.18.13   </strong> <code>public static void <code><b>runFinalization</b></code>()</code></font>
<p>
<a name="6252"></a>
Calling this method suggests that the Java Virtual Machine expend effort toward 
running the finalization methods of objects that have been found to be discarded 
but whose finalization methods have not yet been run. When control returns from 
the method call, the Java Virtual Machine has made a best effort to complete all 
outstanding finalizations.
<p><a name="6253"></a>
The call <code>System.runFinalization()</code> is effectively equivalent to the call:<p>
<pre><a name="6254"></a>Runtime.getRuntime().<code>runFinalization</code>()
</pre><a name="6258"></a>
For a more complete description, see the <code>runFinalization</code> method of class 
<code>Runtime</code> <a href="javalang.doc15.html#7413">(&#167;20.16.10)</a>.
<p><a name="14145"></a>
<p><font size=+1><strong>20.18.14   </strong> <code>public static void <code><b>load</b></code>(String filename)<br>throws SecurityException, UnsatisfiedLinkError</code></font>
<p>
<a name="6285"></a>
This method loads a code file with the specified file name from the local file system.

<p><a name="6286"></a>
The call <code>System.load(name)</code> is effectively equivalent to the call:<p>
<pre><a name="6287"></a>Runtime.getRuntime().load(name)
</pre><a name="6291"></a>
For a more complete description, see the <code>load</code> method of class <code>Runtime</code> 
<a href="javalang.doc15.html#30190">(&#167;20.16.13)</a>.
<p><a name="14146"></a>
<p><font size=+1><strong>20.18.15   </strong> <code>public static void <code><b>loadLibrary</b></code>(String libname)<br>throws SecurityException, UnsatisfiedLinkError</code></font>
<p>
<a name="6315"></a>
This method loads a library code file with the specified library name from the 
local file system.
<p><a name="6316"></a>
The call <code>System.loadLibrary(name)</code> is effectively equivalent to the call<p>
<pre><a name="6317"></a>Runtime.getRuntime().<code>loadLibrary</code>(name)
</pre><a name="6321"></a>
For a more complete description, see the <code>loadLibrary</code> method of class <code>Runtime</code> 
<a href="javalang.doc15.html#52468">(&#167;20.16.14)</a>.
<p><a name="3211"></a>
<p><font size=+1><strong>20.18.16   </strong> <code>public static void <code><b>arraycopy</b></code>(Object src, int srcOffset,<br> &#32; &#32; &#32;Object dst, int dstOffset, int length)<br>throws NullPointerException, ArrayStoreException,<br> &#32; &#32; &#32;	IndexOutOfBoundsException</code></font>
<p>
<a name="6019"></a>
A subsequence of array components is copied from the source array referenced by 
<code>src</code> to the destination array referenced by <code>dst</code>. The number of components copied 
is equal to the <code>length</code> argument. The components at the positions <code>srcOffset</code> 
through <code>srcOffset+length-1</code> in the source array are copied into the positions 
<code>dstOffset</code> through <code>dstOffset+length-1</code>, respectively, of the destination array.
<p><a name="25874"></a>
If the <code>src</code> and <code>dst</code> arguments refer to the same array object, then copying is performed as if the components of the source array at positions <code>srcOffset</code> through <code>srcOffset+length-1</code> were first copied to a temporary array of length <code>length</code> and then the contents of the temporary array were copied into positions <code>dstOffset</code> through <code>dstOffset+length-1</code> of the destination array.<p>
<a name="25887"></a>
If <code>dst</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown.<p>
<a name="6195"></a>
If <code>src</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown and the destination array is not modified.<p>
<a name="6067"></a>
Otherwise, if any of the following is true, then an <code>ArrayStoreException</code> is thrown and the destination is not modified:<p>
<ul><a name="6073"></a>
<li>The <code>src</code> argument refers to an object that is not an array.
<a name="6077"></a>
<li>The <code>dst</code> argument refers to an object that is not an array.
<a name="6111"></a>
<li>The <code>src</code> argument and <code>dst</code> argument refer to arrays whose component types are different primitive types.
<a name="6121"></a>
<li>The <code>src</code> argument refers to an array of primitive component type and the <code>dst</code> argument refers to an array of reference component type.
<a name="6125"></a>
<li>The <code>src</code> argument refers to an array of reference component type and the <code>dst</code> argument refers to an array of primitive component type.
</ul><a name="6136"></a>
Otherwise, if any of the following is true, an <code>IndexOutOfBoundsException</code> is thrown and the destination is not modified:<p>
<ul><a name="6137"></a>
<li>The <code>srcOffset</code> argument is negative.
<a name="6138"></a>
<li>The <code>dstOffset</code> argument is negative.
<a name="6145"></a>
<li>The <code>length</code> argument is negative.
<a name="6151"></a>
<li><code>srcOffset+length</code> is greater than <code>src.length</code>, the length of the <code>src</code> array.
<a name="6155"></a>
<li><code>dstOffset+length</code> is greater than <code>dst.length</code>, the length of the <code>dst</code> array.
</ul><a name="6161"></a>
Otherwise, if the actual value of any component of the source array from position <code>srcOffset</code> through <code>srcOffset+length-1</code> cannot be converted to the component type of the destination array by assignment conversion, then an <code>ArrayStoreException</code> is thrown. In this case, let <i>k</i> be the smallest nonnegative integer less than length such that <code>src[srcOffset+</code><i>k</i><code>]</code> cannot be converted to the component type of the destination array. When the exception is thrown, the source array components from positions <code>srcOffset</code> through <code>srcOffset+</code><i>k</i><code>-1</code> have been copied to destination array positions <code>dstOffset</code> through <code>dstOffset+</code><i>k</i><code>-1</code> and no other positions of the destination array will have been modified. (Because of the restrictions already itemized, this paragraph effectively applies only to the situation where both arrays have component types that are reference types.)<p>
<a name="2668"></a>
<h1>20.19  The Interface  <code>java.lang.Runnable</code></h1>
<a name="7035"></a>
The <code>Runnable</code> interface should be implemented by any class whose instances are 
intended to be executed by a new thread. All that is required of such a class is that 
it implement a method of no arguments called <code>run</code>.
<p><pre><a name="2669"></a>public interface <code><b>Runnable</b></code> {
<a name="3215"></a>	public abstract void <code><b>run</b></code>();
<a name="3224"></a>}
</pre><a name="3219"></a>
<p><font size=+1><strong>20.19.1   </strong> <code>public abstract void <code><b>run</b></code>()</code></font>
<p>
<a name="7036"></a>
The general contract of the method <code>run</code> is that it may take any action whatsoever.
<p><a name="7037"></a>
If an object implementing interface <code>Runnable</code> is used to create a thread <a href="javalang.doc18.html#2658">(&#167;20.20)</a>, then starting the thread will (normally) lead to the invocation of the object's <code>run</code> method in that separately executing thread.<p>


<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javalang.doc16.html">Prev</a> | <a href="javalang.doc18.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright &#169 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -