public class LayerThread implements Runnable {
/**楼层*/
private int index;
/**为此楼层提供服务的电梯*/
private Elevator elevator;
/**
* 构造函数
* */
public LayerThread(){
}
/**
* 构造函数
* @param index(int):楼层
* @prama elevator(Elevator):为此楼层提供服务的电梯
* */
public LayerThread(int index , Elevator elevator){
this.index = index;
this.elevator = elevator;
}
/**
* run()
* */
public void run() {
System.out.println("楼层" + index + ",提供服务的电梯是:"+elevator.getName());
}
}[/code]7.MainClass类[code=java]package cn.zjc.test.elevator;
/**
* 启动类
* */
public class MainClass {