我在这个包中定义了这个节点:
package provided;
public interface Node{
public Node getNext();
}
这里我想使用Node,嵌套类“LinkedListIterator”中的问题,它无法看到我的Node方法:
import provided.Node;
class LinkedList {
private Node head;
head.getNext(); // there is no error here, the method getNext() is available
class LinkedListIterator <Node> implements Iterator<Node> {
private Node next_node;
public Node next(){
return next_node.getNext(); // The method getNext() is
// undefined for the type Node
}
}
}