My display function is not working and do you which whole program not working
package LinkedList;
import java.util.LinkedList;
public class addFirst {
public static void main(String[] args) {
// TODO Auto-generated method stub
LinkedList list=new LinkedList<>();
list.addFirst(10);
printList(list);
}
public class Node{
Node next;
int data;
}
private Node head;
private Node tail;
private int size;
public static void printList(LinkedList list)
{
Node currNode =new Node();
Node currNode = head;
System.out.print("LinkedList: ");
// Traverse through the LinkedList
while (currNode != null) {
// Print the data at current node
System.out.print(currNode.data + " ");
// Go to next node
currNode = currNode.next;
}
}
public void addFirst(int val) {
Node temp=new Node();
temp.data=val;
temp.next=null;
size++;
if(size==0) {
head=tail=temp;
}else {
temp.next=head;
temp=head;
}
}
}