-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunnerLinkedList.java
29 lines (24 loc) · 1010 Bytes
/
RunnerLinkedList.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
import linkedlist.Node;
import linkedlist.LinkedList;
public class RunnerLinkedList {
public static void main(String[] args) {
LinkedList stack = new LinkedList();
stack.push("Celine");
stack.push("Jungkook");
stack.push("Taehyung");
System.out.println(stack.pop()); // Taehyung
System.out.println(stack.pop()); // Jungkook
System.out.println(stack.pop()); // Celine
System.out.println(stack.pop()); // null cuz end of stack
System.out.println(stack.pop()); // null cuz end of stack
////////////////////////////////////
LinkedList queue = new LinkedList();
queue.enqueue("Celine");
queue.enqueue(2004);
queue.enqueue("Effat University");
System.out.println(queue.dequeue()); // Celine
System.out.println(queue.dequeue()); // 2004
System.out.println(queue.dequeue()); // Effat University
System.out.println(queue.dequeue()); // null cuz end of queue
}
}