Java实现线程的方法有两种
分别是:
/**
* @author LiuTaiyi
* @description implements Runnable
* @date 2019/8/22
*/
public class testThread implements Runnable {
@Override
public void run() {
System.out.println("implements Runnable方法实现线程");
}
}
和
public class testThread2 extends Thread {
public void run() {
System.out.println("extends Thread 方法实现线程");
}
}