线程-run和start

import java.lang.Thread;
class Machine extends Thread{
    public void run()
    {
        int a ;
        for( a = 0 ; a < 50 ; a ++ )
        {
            System.out.println(currentThread().getName()+":"+a);
            try{
                sleep(100);
            }catch(InterruptedException e){
                throw new RuntimeException(e);
            }
        }
    }
}
public class Static {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Machine machine1 = new Machine();
        Machine machine2 = new Machine();
        machine1.start();
        machine2.start();
        machine1.run();
    }
}
原文地址:https://www.cnblogs.com/minmsy/p/5714068.html