I’m trying to create a list in Java, I also have a Test code that isn’t compiling as well
public class IntList {
private IntNode head;
public IntList() {
head = null;
}
public void addToHead(int n) {
head = new IntNode(n, head);
}
public void deleteFromHead() {
head = head.getNext();
}
public boolean isEmpty() {
return head == null;
}
public void printlist() {
if (isEmpty()) {
System.out.println("The list is empty");
}
else {
IntNode node = head;
while (node != null) {
System.out.println(node.getData() + " ");
node = node.getNext();
}
System.out.println();
}
}
}