public class TestThread{ public static void main(String[] args){ MyRunner r = new MyRunner(); Thread t = new Thread(r); t.start(); for(int i=0;i<100;i++){ System.out.println("Main:"+i); } } } class MyRunner implements Runnable{ public void run(){ for(int i=0;i<100;i++){ System.out.println("MyRunner:"+i); } } }
编写一个小程序,观察线程的执行
猜你喜欢
转载自www.cnblogs.com/yxfyg/p/12409774.html
今日推荐
周排行