✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Select an appropriate expression to complete the method below, which is designed to print the element at the bottom of a Stack collection. The contents of the original stack are restored before the method terminates. It is safe to assume that the original stack contains at least one element.
public static void printBottom(Stack<String> theStack)
{
Stack<String> anotherStack = new Stack<>();
while (!theStack.empty())
{
anotherStack.push(theStack.pop());
}
____________________________
while (!anotherStack.empty())
{
theStack.push(anotherStack.pop());
}
}
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!