Java多线程整理:
package ziboshizhangdianqu; class A extends Thread{ public void run(){ for(int i=0;i<100;i++){ System.out.println("此树是我栽"); } } } class B extends Thread{ public void run(){ for(int i=0;i<100;i++){ System.out.println("此路是我开"); } } } class C extends Thread{ public void run(){ for(int i=0;i<100;i++){ System.out.println("要想过此路"); } } } class D extends Thread{ public void run(){ for(int i=0;i<100;i++){ System.out.println("留下买路财"); } } } public class Dxc { public static void main(String[] args) { new A().start(); new B().start(); new C().start(); new D().start(); } }
运行结果: