Metoda Java Stack Class Search ()

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);

       // Search an element
        int position = fruits.search("Banana");
        System.out.println("Position of Banana: " + position);
    }
}
Outrageous Ostrich