Java实现多线程的三种方法
一继承Thread类的步骤:
代码示例:
public class ThreadDemo { public static void main(String[] args) { System.out.println("一边听音乐..."); Thread p1=new Person(); p1.start(); } } class Person extends Thread{ @Override public void run() { System.out.println("一边写代码..."); } }
原文:https://www.cnblogs.com/majestyking/p/12426388.html