我有一个有块的类Floor
,Stack
我不知道如何初始化它。我试过这样:
public class Floor {
private Stack<Block> stack;
private static int size;
public void setStack(Stack<Block> stack) {
this.stack = stack;
}
public void addBlock(Block b){
stack.push(b);
}
}
public class InputDevice {
Block a0=new Block('I',false);
Floor [] floor=new Floor[5];
Stack<Block> stack=new Stack<Block>();
floor[0].setStack(stack);
floor[0].addBlock(a0);
}