Ch trình tự cài đặt LinkedList nhưng thiếu sót nhiều…a e xem và chỉ ra lỗi giúp mình với
/**
* Created by Admin on 10/7/2015.
*/
public class LinkedList {
private int size=0;
private Node head, tail;
private static class Node {
private String data;
private Node next;
}
public LinkedList() {
head = tail = null;
}
public boolean isEmpty() {
return (head == null && tail == null);
}
public void addFirst(String item) {
Node q = new Node();
q.data = item;
q.next = head;
head = q;
size++;
}
public void addLast(String item) {
Node q = new Node();
q.data = item;
q.next = null;
tail.next = q;
size++;
}
public void removeFirst() {
if (head == null)
System.out.print("Error");
else {
Node i = head;
head = head.next;
size--;
}
}
public static void main(String[] args) {
LinkedList list=new LinkedList();
list.addFirst("a");
list.addFirst("n");
list.addFirst("h");
System.out.print(list);
}
}

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?