肯定不用引入java.lang.Thread,不信你试试!- public class TestThread1 {
- public static void main(String args[]) {
- Runner1 r = new Runner1();
- Thread t = new Thread(r);
- t.start();
-
- for(int i=0; i<100; i++) {
- System.out.println("Main Thread:------" + i);
- }
- }
- }
- class Runner1 implements Runnable {
- public void run() {
- for(int i=0; i<100; i++) {
- System.out.println("Runner1 :" + i);
- }
- }
- }
复制代码 |