public class my extends Thread{
public void run(){
for(int i=0;i<10;i++)
{
System.out.print(i);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
//另外一种方法runnable接口
class my implements Runnable{
public void run(){}
}
线程
最新推荐文章于 2022-12-24 21:37:24 发布