public class MyThread extends Thread
{
public void run(){
for(int i=0;i<50;i++){
try{ Thread.sleep(100);}catch(Exception e){}
System.out.println(Thread.currentThread().getName()+" : "+i);
}
}
public static void main(String[] args)
{
MyThread t1 = new MyThread();
t1.start();
t1.run();//函数调用
}
}
转载于:https://www.cnblogs.com/haiwei_sun/articles/2405824.html