日期:2014-05-20 浏览次数:20854 次
package com.java.traffic;
import java.util.ArrayList;
public class ThreadTest2 {
public void runCar12(){
while(true){
System.out.println("runCar thread running");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static class Crun extends Thread{
ThreadTest2 c=null;
ArrayList<Light> lgts=null;
public Crun(ThreadTest2 c){
this.c=c;
}
public void run(){
c.runCar12();
}
}
public static void main(String[]args){
ThreadTest2 c=new ThreadTest2();
System.out.println("------------A");
Thread t=new Crun(c);
t.run();
System.out.println("------------B");
}
}