Help with two stacks in one array exercise solution

Hi,

I am taking Part 1 of the Data Structures course and just wanted to ask about the exercise to implement two stacks in one array.

I am quite puzzled about the solution provided in the TwoStacks.java file.

I undertand that the solution is memory efficient, because it shares the same array positions for both stacks, but can’t imagine a practical use for it.

In which case would I want to use two stacks that share the same array positions in that way?