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

📄 java08_02.htm

📁 JAVA的课件
💻 HTM
📖 第 1 页 / 共 2 页
字号:
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;boolean</code></font></td>
      <td><code><b>isDaemon</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests if   
        this thread is a daemon thread.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;boolean</code></font></td>
      <td><code><b>isInterrupted</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests   
        whether this thread has been interrupted.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>join</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Waits for   
        this thread to die.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>join</b>(long&nbsp;millis)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Waits at   
        most <code>millis</code> milliseconds for this thread to die.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>join</b>(long&nbsp;millis,  
        int&nbsp;nanos)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Waits at   
        most <code>millis</code> milliseconds plus <code>nanos</code>   
        nanoseconds for this thread to die.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>resume</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Deprecated.</b>&nbsp;<i>This   
        method exists solely for use with <code>suspend()</code>,   
        which has been deprecated because it is deadlock-prone. For more   
        information, see Why   
        are Thread.stop, Thread.suspend and Thread.resume Deprecated?.</i></td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>run</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果类是使用单独的Runnable对象构造的,将调用Runnable对象的run方法,否则本方法不做任何事情就返回了。<br>
        &nbsp;&nbsp;&nbsp; 如果是子类继承Thread类,请务必实现本方法以覆盖父类的run方法。</td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>setContextClassLoader</b>(ClassLoader&nbsp;cl)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the   
        context ClassLoader for this Thread.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>setDaemon</b>(boolean&nbsp;on)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Marks this   
        thread as either a daemon thread or a user thread.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>setName</b>(String&nbsp;name)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Changes the   
        name of this thread to be equal to the argument <code>name</code>.</td>  
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>setPriority</b>(int&nbsp;newPriority)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;改变线程的优先级,Java定义了三种级别:Thread.MIN_PRIORITY,Thread.MAX_PRIORITY 
        , 和Thread.NORM_PRIORITY</td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>static&nbsp;void</code></font></td>
      <td><code><b>sleep</b>(long&nbsp;millis)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正在运行的线程睡眠(暂停),参数millis指定毫秒数。</td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>static&nbsp;void</code></font></td>
      <td><code><b>sleep</b>(long&nbsp;millis,  
        int&nbsp;nanos)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正在运行的线程睡眠(暂停),millis指定毫秒数,nanos指定纳秒数</td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>start</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Causes this  
        thread to begin execution; the Java Virtual Machine calls the <code>run</code>  
        method of this thread.</td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>stop</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Deprecated.</b>&nbsp;<i>This  
        method is inherently unsafe. Stopping a thread with Thread.stop causes  
        it to unlock all of the monitors that it has locked (as a natural  
        consequence of the unchecked <code>ThreadDeath</code> exception  
        propagating up the stack). If any of the objects previously protected by  
        these monitors were in an inconsistent state, the damaged objects become  
        visible to other threads, potentially resulting in arbitrary behavior.  
        Many uses of <code>stop</code> should be replaced by code that simply  
        modifies some variable to indicate that the target thread should stop  
        running. The target thread should check this variable regularly, and  
        return from its run method in an orderly fashion if the variable  
        indicates that it is to stop running. If the target thread waits for  
        long periods (on a condition variable, for example), the <code>interrupt</code>  
        method should be used to interrupt the wait. For more information, see Why  
        are Thread.stop, Thread.suspend and Thread.resume Deprecated?.</i></td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>stop</b>(Throwable&nbsp;obj)</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Deprecated.</b>&nbsp;<i>This  
        method is inherently unsafe. See <code>stop()</code>  
        (with no arguments) for details. An additional danger of this method is  
        that it may be used to generate exceptions that the target thread is  
        unprepared to handle (including checked exceptions that the thread could  
        not possibly throw, were it not for this method). For more information,  
        see Why  
        are Thread.stop, Thread.suspend and Thread.resume Deprecated?.</i></td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;void</code></font></td>
      <td><code><b>suspend</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Deprecated.</b>&nbsp;<i>This  
        method has been deprecated, as it is inherently deadlock-prone. If the  
        target thread holds a lock on the monitor protecting a critical system  
        resource when it is suspended, no thread can access this resource until  
        the target thread is resumed. If the thread that would resume the target  
        thread attempts to lock this monitor prior to calling <code>resume</code>,  
        deadlock results. Such deadlocks typically manifest themselves as  
        &quot;frozen&quot; processes. For more information, see Why  
        are Thread.stop, Thread.suspend and Thread.resume Deprecated?.</i></td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>&nbsp;String</code></font></td>
      <td><code><b>toString</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a  
        string representation of this thread, including the thread's name,  
        priority, and thread group.</td> 
    </tr>
    <tr class="TableRowColor" >
      <td vAlign="top" align="right" width="1%"><font size="-1"><code>static&nbsp;void</code></font></td>
      <td><code><b>yield</b>()</code><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正在运行的线程暂停,同时允许其它的线程运行</td>
    </tr>
  </tbody>
</table>

<p align="left"> </p>
<p align="left"><a href="index.htm">回目录</a>   <a href="java08_01.htm">上一课</a> 
<a href="java08_03.htm">下一课</a></p>

</body>

</html>

⌨️ 快捷键说明

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