当我尝试以这种形式编译代码时,会生成编译错误“Incompatible types - found java.lang.Object but expected E”:
public class E {
private int x;
public E {
x = 0;
}
}
public class Class {
private E o;
private E b;
private Stack stack = new Stack();
public void foo() {
stack.push(o);
}
public void bar() {
**b = stack.pop();**
}
}