Home > AI > Language > Java >

Stack

import java.util.*;

class Test {


    public static void main (String[] args)
    {
        Stack<Integer> stack = new Stack<>();

        stack.push(3);
        stack.push(5);
        System.out.printf("%d\n", stack.pop());
        System.out.printf("%d\n", stack.search(3));
        System.out.printf("%d\n", stack.peek());

    }
}

Leave a Reply