Java Stack Class Empty () Метод
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("Stack: " + fruits);
// Check if stack is empty
boolean check = fruits.empty();
System.out.println(check);
}
}
Outrageous Ostrich