Java Stacks

The Stack class is found in java.util and it extends the Vector Class. This means it can grow and shrink as needed, which is helpful for a Stack. As it extends a Vector, it is helpful to Parameterize the constructor. Just like the Stack that we’ve created, it has the same methods: push(), pop(), and…