????Java???????????object????????????????java.lang.Thread???????? ?????????·????java?д??????????
????Tread thread = new Thread();
??????и???????????????start()????:
????thread.start();
????????????????У??????????????д???д?????????÷??????????????
??????д??????????е??????????????????????Thread???????????????дrun?????????????????????????Runnable?????????????????彲?????????????
????????Thread??????
????????Thread???????????????дrun??????run???????????start()?????????С????????£?
????public class MyThread extends Thread {
????public void run(){
????System.out.println("MyThread running");
????}
????}
?????????????·????????????????Thread????
????MyThread myThread = new MyThread();
????myTread.start();
???????????????start?????????????????????????run???????????????????run???????????????cpu????????????run??????к??????????????MyThread running??
??????????????′??????Thread??????????
????Thread thread = new Thread(){
????public void run(){
????System.out.println("Thread Running");
????}
????};
????thread.start();
???????μ?????run????????????????????????????”Thread Running”??
???????Runnable???
??????????д?????д???????????????????java.lang.Runnable????????????????е??????????????á?????????????
????public class MyRunnable implements Runnable {
????public void run(){
????System.out.println("MyRunnable running");
????}
????}
?????????????????run()???????????Thread?????????д??? MyRunnable???????????????£?
????<span style="color: #ff0000;">Thread thread = new Thread(new MyRunnable());</span>
????thread.start();
??????????????????????????????Runnable????run???????????н???????”MyRunnable running”??