标签:style blog color art re c div ar
public class Thread1 extends Thread{ public void run(){ int i=0; while(i<10){ i++; System.out.println(i); } } public static void main(String[] args){ Thread1 t=new Thread1(); t.start(); } }
public class Thread2 implements Runnable{ @Override public void run() { int i=10; while(i>0){ i--; System.out.println(i); } } public static void main(String[] args){ Thread2 t=new Thread2(); new Thread(t).start(); } }
线程,较难讲透,初学者不易掌握,带过即可。
爪哇国新游记之十二----线程创建的两种形式,布布扣,bubuko.com
标签:style blog color art re c div ar
原文地址:http://www.cnblogs.com/xiandedanteng/p/3867499.html