java线程几种类型_Java线程类

  • Post author:
  • Post category:java


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

)


  1. Thread

    ()


    线程

    ()


  2. Thread

    (String str)


    线程

    (字符串str)


  3. Thread

    (Runnable r)


    线程

    (可运行r)


  4. Thread

    (Runnable r, String str)


    线程

    (Runnable r,字符串str)


  5. Thread

    (

    ThreadGroup

    group,

    Runnable

    target)


    线程

    (

    ThreadGroup

    组,

    Runnable

    目标)


  6. Thread

    (

    ThreadGroup

    group,

    Runnable

    target, String name)


    线程

    (

    ThreadGroup

    组,

    Runnable

    目标,字符串名称)


  7. Thread

    (

    ThreadGroup

    group,

    Runnable

    target, String name, long stackSize)


    线程

    (

    ThreadGroup

    组,

    Runnable

    目标,字符串名称,长stackSize)


  8. Thread

    (

    ThreadGroup

    group,

    String

    name)


    线程

    (

    ThreadGroup

    组,