s-day05-多线程的第二种实现方式(重点)
This commit is contained in:
@@ -12,7 +12,7 @@ package com.inmind.thread01;
|
||||
public static Thread currentThread() :获取到当前正在执行的线程对象。(重点)
|
||||
*/
|
||||
public class Demo01 {
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
public static void main(String[] args) throws Exception {
|
||||
/*
|
||||
public Thread() :分配一个新的线程对象。
|
||||
Thread-0-1-2:无参构造的线程名称
|
||||
@@ -31,7 +31,7 @@ public class Demo01 {
|
||||
想让当前线程暂停10毫秒,再执行
|
||||
public static void sleep(long millis) :使当前正在执行的线程以指定的毫秒数暂停(暂时停止执行)。
|
||||
*/
|
||||
//Thread.sleep(10);
|
||||
Thread.sleep(10);
|
||||
/*
|
||||
主线程的名称到底叫什么???获取主线程对象,调用它的getName即可
|
||||
public static Thread currentThread() :获取到当前正在执行的线程对象。(重点)
|
||||
|
||||
Reference in New Issue
Block a user