??????3????????Runnable????????????????????
??????????????????????????????????????????????????統(tǒng)???A?????B????????100????????????д???????100?????????????????????????????????????????????????????????????????????????????????100??????????????????????????????????????????????????????????????????????????????????????????
public class MutliThreadDemo3 {
public static void main(String [] args){
MutliThread m=new MutliThread();
Thread t1=new Thread(m??"Window 1");
Thread t2=new Thread(m??"Window 2");
Thread t3=new Thread(m??"Window 3");
t1.start();
t2.start();
t3.start();
}
}
class MutliThread implements Runnable{
private int ticket=100;//??????????100???
public void run(){
while(ticket>0){
System.out.println(ticket--+" is saled by "+Thread.currentThread().getName());
}
}
}
???????????????????????????????????н?????????????????????????????????????????????????????????????????????е????????????????????е?????????????
???????????????????????????????????????????????????????????仹????????????????????????????Runnable???????????????????????????????????Thread???????????????????????????
???????Runnable???????????Thread?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Ч??????????????????????????????????????????е????????????????Runnable?????????????