Put the code you need help with here.
publicclass FirstList {
//reference to the head node.
private Node head;
privateint count;
//LinkedList constructor
public FirstList() {
//this is an empty list, so the reference to the head node
//is set to a new node with no data
head = new Node(null);
count = 0;
}
@SuppressWarnings("unchecked")
publicvoid add(Object data)
//appends the specified element to the end of this list
{
Node temp = new Node();
Node current = head;
//starting at the head node, crawl to the end of the list
while(current.getNext() != null) {
current = current.getNext();
}
//the last node's "next" reference set to our new node
current.setNext(temp);
count++;
}
public Object get() {
Node current = head.getNext();
return current.getData();
}
publicstaticvoid main(String[] args) {
FirstList l = new FirstList();
l.add(56);
l.add(25);
System.out.println(l);
}
}