import java.util.Stack;
public class MyClass {
public static void main(String args[]) {
Stack<String> stack = new Stack<>();
stack.push("3");
stack.push("8");
stack.push("3");
stack.push("8");
stack.push("9");
stack.push("3");
stack.push("3");
stack.push("9");
System.out.println("The first Index of element '3' is : " + stack.indexOf("3"));
System.out.println("The first Index of element '9' is : " + stack.indexOf("9"));
}
}
/*
run:
The first Index of element '3' is : 0
The first Index of element '9' is : 4
*/