Code example for Stack

Methods: peek, removeAllElements

0
 */ 
public final class StackExample2 { 
 
  public static void main(String[] args) {
    try { 
      Stack s1 = new Stack();
      Stack s2 = new Stack();
      s1.removeAllElements();
      s2.push(new Object());
      s1.peek();
    } catch (Exception e) {
      e.printStackTrace();
    } 
  } 
}