MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / main

Method main

11. Stack/stackArray.java:2–19  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

1class stackArray {
2 public static void main(String[] args) {
3 StackX theStack = new StackX(10); // create a stack with max size 10
4
5 theStack.push(30); // insert given items
6 theStack.push(80);
7 theStack.push(100);
8 theStack.push(25);
9
10 //To peak the the last element pushed
11 System.out.println(theStack.peek());
12
13 while(!theStack.isEmpty()) { // until it is empty, delete item from stack
14
15 double val = theStack.pop();
16 System.out.print(val);
17 System.out.print(" ");
18 }
19 }
20}
21
22//Implementation of Stack Class

Callers

nothing calls this directly

Calls 5

pushMethod · 0.95
peekMethod · 0.95
isEmptyMethod · 0.95
popMethod · 0.95
printMethod · 0.45

Tested by

no test coverage detected