Stacks

less than 1 minute read

Stack<Integer> stack = new Stack<>();
stack.push(10);
stack.add(10);// Both add and push does the same thing
stack.pop();// return the value and pops the top
if (!stack.isEmpty());
stack.peek();// Return the top

Stacks

Stacks print in an [a, b, c] format from bottom to top