class MyThread extends Thread{
private String name;
public MyThread(String name){
this.name=name;
}
public void run(){
for(int i=0;i<10;i++){
System.out.println(name+"运行,i="+i);
}
}
}
public class Test{
public static void main(String[] args){
MyThread mt1=new MyThread("线程A");
MyThread mt2=new MyThread("线程B");
mt1.start();
mt2.start();
}
}
用多线程呀
多线程轻松啊
多线程啊.
循环次数都不一样,什么叫同步执行?