-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathStacks.java
More file actions
33 lines (27 loc) · 789 Bytes
/
Copy pathStacks.java
File metadata and controls
33 lines (27 loc) · 789 Bytes
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
package Java.StacksJava;
public class Stacks {
public static void main(String[] args) {
StackApp my_stack = new StackApp(10);
my_stack.push(10);
my_stack.push(20);
my_stack.push(40);
my_stack.push(30);
System.out.println(my_stack.peek());
my_stack.display();
my_stack.push(60);
my_stack.push(80);
my_stack.display();
System.out.println(my_stack.pop());
my_stack.display();
my_stack.push(100);
my_stack.push(50);
my_stack.push(90);
my_stack.display();
while (!my_stack.isEmpty()) {
long value = my_stack.pop();
System.out.print(value);
System.out.print(" ");
}
System.out.println("");
}
}