-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.java
36 lines (26 loc) · 948 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("Linked List - Java \n");
LinkedList list = new LinkedList();
list.insertAt(new Node(new Student("Huy", 20)), 10);
Student Nam = new Student("Nam", 23);
Node newNode = new Node(Nam);
list.insertAt(newNode, 1);
list.insertAt(new Node(new Student("Huy Nguyễn", 30)), 20);
list.insertAt(new Node(new Student("Huy Ngọc Nguyễn", 40)), 134);
list.insertAt(new Node(new Student("Huy 23423 Nguyễn", 45)), 355);
list.printList();
int id = 3;
list.delete(id);
// Node searchNode = list.search(id);
// if (searchNode != null) {
// System.out.print("Student cần tìm: \n");
// searchNode.student.printInfo();
// } else {
// System.out.print("Student id = " + id + " không có trong danh sách \n");
// }
System.out.print("\n\nSau khi xóa:");
list.printList();
}
}