hello can you help me please my program will generate error it says can't find symbol Class Node
please help me hoping for your positive responds...
here's the error...
D:\SinglyLinkedList.java:16: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
private Node head;
^
D:\SinglyLinkedList.java:17: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
private Node tail;
^
D:SinglyLinkedList.java:20: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
public Node add(Node n)
^
D:\SinglyLinkedList.java:20: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
public Node add(Node n)
^
D:\SinglyLinkedList.java:41: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
public Node addFirst(Node n)
^
D:\SinglyLinkedList.java:41: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
public Node addFirst(Node n)
^
D:\SinglyLinkedList.java:63: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
public Node getFirst()
^
D:\SinglyLinkedList.java:67: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
public Node getLast()
^
D:\SinglyLinkedList.java:95: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
Node n = new Node();
^
D:\SinglyLinkedList.java:95: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
Node n = new Node();
^
D:\SinglyLinkedList.java:103: cannot find symbol
symbol : class Node
location: class SinglyLinkedList
Node n = list.getFirst();
^
11 errors
Process completed.
public class SinglyLinkedList
{
private Node head;
private Node tail;
private int size=0;
public Node add(Node n)
{
if(isEmpty())
{
head=n;
tail=n;
}
else
{
tail.next=n;
tail=n;
}
size ++;
return n;
}
public Node addFirst(Node n)
{
if(isEmpty())
{
head =n;
tail =n;
}
else
{
n.next = head;
head =n;
}
return n;
}
public Node getFirst()
{
return head;
}
public Node getLast()
{
return tail;
}
public boolean isEmpty()
{
return head == null;
}
public int size()
{
return size;
}
public static void main(String[] args)
{
SinglyLinkedList list = new SinglyLinkedList();
for(int i=0;i<10;i++)
{
Node n = new Node();
n.value="Miguel" + (i+1);
list.add(n);
}
Node n = list.getFirst();
while(n!=null)
{
System.out.println(n.value);
n = n.next;
}
}
}