public interface MoveAble {
void move();
}
public class Tank1 implements MoveAble{
@Override
public void move() {
System.out.println("moving");
}
}
/**
*
* 聚合
*
*/
public class TankTime3 implements MoveAble{
private MoveAble t;
public TankTime3(){}
public TankTime3(MoveAble t){
this.t=t;
}
@Override
public void move() {
long s = System.currentTimeMillis();
t.move();
long e = System.currentTimeMillis();
System.out.println(e-s);
}
}
public class Test {
public static void main(String[] args) {
Tank1 t =new Tank1();
TankTime3 tt = new TankTime3(t);
tt.move();
}
}