以下代码给我报错:"类型不匹配:无法将ArrayList转换为StackInterface"。我该如何进行转换,或者我是否使用了错误的数据类型ArrayList?
public class PostFixStack<T> implements StackInterface<T>
protected ArrayList<T> elements; // ArrayList that holds stack elements
public PostFixStack() {elements = new ArrayList<T>();
}
public int evaluate(String expression){
Scanner tokenizer = new Scanner(expression);
StackInterface<Integer> stack = new ArrayList<T>();
StackInterface
不是List
类型。 - soorapadman