I'm working on an assignment where I have to create a linked list from scratch and have come across an error when compiling that the "constructor Node in class Node cannot be applied to given types;"
This is what I'm trying, the error says:
required: no arguments found: string
Yet I cannot see where I am going wrong as my constructor for Node requires a string?
public class Node {
String data;
Node next;
public void Node(String x) {
data = x;
next = null;
}
}
public class stringList {
private Node head;
private int count;
public void stringList() {
head = null;
count = null;
}
public void add(String x) {
Node temp = new Node(x);
}
This is a screenshot of the error the compiler is showing