java线程几种类型
Thread class is the main class on which Java’s Multithreading system is based. Thread class, along with its companion interface Runnable will be used to create and run threads for utilizing Multithreading feature of Java.
线程类是Java多线程系统所基于的主要类。 线程类及其配套接口Runnable将用于创建和运行线程,以利用Java的多线程功能。
It provides constructors and methods to support multithreading. It extends object class and implements Runnable interface.
它提供了构造函数和方法来支持多线程。 它扩展了对象类并实现了Runnable接口。
线程类的签名
(
Signature of Thread class
)
public class Thread extends Object implements Runnable
线程类优先级常量
(
Thread Class Priority Constants
)
Field | Description |
---|---|
MAX_PRIORITY | It represents the maximum priority that a thread can have. |
MIN_PRIORITY | It represents the minimum priority that a thread can have. |
NORM_PRIORITY | It represents the default priority that a thread can have. |
领域 | 描述 |
---|---|
MAX_PRIORITY | 它表示线程可以具有的最大优先级。 |
MIN_PRIORITY | 它表示线程可以具有的最低优先级。 |
NORM_PRIORITY | 它表示线程可以具有的默认优先级。 |
线程类的构造函数
(
Constructors of Thread class
)
-
Thread
()
线程
() -
Thread
(String str)
线程
(字符串str) -
Thread
(Runnable r)
线程
(可运行r) -
Thread
(Runnable r, String str)
线程
(Runnable r,字符串str) -
Thread
(
ThreadGroup
group,
Runnable
target)
线程
(
ThreadGroup
组,
Runnable
目标) -
Thread
(
ThreadGroup
group,
Runnable
target, String name)
线程
(
ThreadGroup
组,
Runnable
目标,字符串名称) -
Thread
(
ThreadGroup
group,
Runnable
target, String name, long stackSize)
线程
(
ThreadGroup
组,
Runnable
目标,字符串名称,长stackSize) -
Thread
(
ThreadGroup
group,
String
name)
线程
(
ThreadGroup
组,