public class LinkedList { Node first , last; private int count; public LinkedList(){ } public void addFirst(Object x){ if (count==0){ first=last=new Node (x); } else { Node temp=new Node(x); temp.next=first; first=temp; } count++; } public void addLast(Object x){ if (count==0){ first=last=new Node (x); } else { Node temp = new Node(x); last.next=temp; last=last.next; } count++; } public void printList(){ Node temp=first; for(int i =1;i