forked from avinashbest/java-coding-ninjas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackUse.java
More file actions
37 lines (33 loc) · 1.11 KB
/
Copy pathStackUse.java
File metadata and controls
37 lines (33 loc) · 1.11 KB
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
37
package stacks;
public class StackUse {
public static void main(String[] args) {
/* StackUsingArrays stack = new StackUsingArrays();
stack.push(10);
stack.push(20);
stack.push(30);
System.out.println(stack.top());
System.out.println(stack.pop());
System.out.println(stack.size());
System.out.println(stack.isEmpty());*/
StackUsingLinkedList<Integer> stack = new StackUsingLinkedList<>();
stack.push(10);
stack.push(20);
stack.push(30);
stack.push(40);
stack.push(50);
stack.push(60);
stack.push(70);
System.out.println(stack.size());
System.out.println(stack.isEmpty());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.top());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.size());
}
}