s-day05--多线程的第二种实现方式(重点)--Runnable

This commit is contained in:
xx
2026-10-19 11:16:27 +08:00
parent 4a167470ae
commit 652af59d42
2 changed files with 35 additions and 0 deletions
@@ -0,0 +1,13 @@
package com.inmind.runnable_thread02;
//当前类不是线程类,只是用来定义线程任务的,所以可以理解为是一个线程任务类
public class RunnableImpl implements Runnable{
@Override
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println(Thread.currentThread().getName()+"------"+i);
}
System.out.println("子线程结束了");
}
}