本帖最后由 风悠悠 于 2013-10-19 21:26 编辑
现在开始看视频
- //主函数
- package cn.itcast.traffic;
- public class MyTraffic {
- public static void main(String[] args) throws Exception {
- EastAndWest EW=new EastAndWest();
- NorthAndSouth NS=new NorthAndSouth();
- Dextroversion Dex=new Dextroversion();</P>
- String[] directions={"S2N","S2W","E2W","E2S","N2S","N2E","W2E","W2N","S2E","E2N","N2W","W2S"} ;
- Thread EW_thread=new Thread(EW);
- Thread NS_thread=new Thread(NS);
- NS_thread.start();
- EW_thread.start();
- for(String direction:directions){
- new Thread(new Road(direction,EW,NS,Dex)).start();
- }
- new Control(EW,NS).run();
- }
复制代码 |