public class TestThreadD extends Thread{
private String content;
TestThreadD(String content){
this.content=content;
}
public void run() {
for (int i = 0; i < 5; i++) {
System.out.println(content);
}
}
}
public class PrintThread {
public static void main(String[] args) {
TestThreadD myThread=new TestThreadD("线程一正在运行");
myThread.start();
TestThreadD myThread2=new TestThreadD("线程二正在运行");
myThread2.start();
}
}