public Object push(Object element)
This adds the element to the top of the stack or to the end of the vector.
import java.util.Stack; public class MainClass { public static void main (String args[]) { Stack s = new Stack(); s.push("A"); s.push("B"); s.push("C"); System.out.println(s); } }
[A, B, C]