Método da classe de pilha java ()
import java.util.Stack;
class Main {
public static void main(String[] args) {
Stack<String> fruits= new Stack<>();
// Add elements to Stack
fruits.push("Apple");
fruits.push("Banana");
fruits.push("Mango");
System.out.println("Initial Stack: " + fruits);
// Remove element stacks
String fruit = fruits.pop();
System.out.println("Removed Element: " + fruit);
}
}
Outrageous Ostrich