I\'m attempting to implement a circular queue class in Java. And in doing so I had to created a node class to group together elements and pointers to the next node. Being ci
You cannot refer tho this (or super) in a constructor, so you should change your code like this:
public class Node{
private Key key;
private Node next;
public Node(){
key = null;
next = this;
}
public Node(final Key k){
key = null;
next = this;
}
public Node(final Key k, final Node node){
key = k;
next = node;
}
public boolean isEmpty(){return key == null;}
public Key getKey(){return key;}
public void setKey(final Key k){key = k;}
public Node getNext(){return next;}
public void setNext(final Node n){next = n;}
}