我Node<T>
在课堂上有一个(内部)Graph<T>
课程:
public class Graph<T> {
private ArrayList<Node<T>> vertices;
public boolean addVertex(Node<T> n) {
this.vertices.add(n);
return true;
}
private class Node<T> {...}
}
当我运行这个:
Graph<Integer> g = new Graph<Integer>();
Node<Integer> n0 = new Node<>(0);
g.addVertex(n0);
最后一行给我错误:
The method addVertice(Graph<Integer>.Node<Integer>) in the type Graph<Integer> is not applicable for the arguments (Graph<T>.Node<Integer>)
为什么?提前致谢?