JAVA_线程的基本概念
时间:2015-05-11 23:23:38
收藏:0
阅读:193
1 public class TestThread1 { 2 public static void main(String args[]) { 3 Runner1 r = new Runner1(); 4 //r.start(); 5 //r.run(); 6 Thread t = new Thread(r); 7 t.start(); 8 9 for(int i=0; i<100; i++) { 10 System.out.println("Main Thread:------" + i); 11 } 12 } 13 } 14 15 class Runner1 implements Runnable { 16 //class Runner1 extends Thread { 17 public void run() { 18 for(int i=0; i<100; i++) { 19 System.out.println("Runner1 :" + i); 20 } 21 } 22 }
评论(0)