import java.util.*; class Stack { private LinkedList data; public Stack() { data = new LinkedList(); } public void push(Object o) { data.addFirst(o); } public Object pop() throws NoSuchElementException { return data.removeFirst(); } public int size() { return data.size(); } public void clear() { data.clear(); } } End of Listing