We can add multiple elements in a stack by using an array or arraylist as follows:
Stack<int[]> stack = new Stack<>();
For retrieval :
int[] elem = stack.peek() ; or stack.pop()
elem[0] , elem[1] ; however you want to access it .