class Apple extends Thread{
String token;
public Apple(String token) { // 与类同名为构造方法
this.token=token;
}
public static void prepare(String token){
try{
sleep(1000); //延时1000毫秒
System.out.println(token);
}catch (Exception e){
System.out.println(e);
}
}
@Override
public void run() {
prepare(this.token);
}
}
public class CS{
public static void main(String[] args) {
for(int i=5;i>0;i--) {
Apple mT = new Apple("线程:" + i);
mT.start();
}
}
}



