Stack: peek() : Stack « java.util « Java by API






Stack: peek()

 
import java.util.Stack;

public class Main {
  public static void main (String args[]) {
    Stack<String> s = new Stack<String>();
    s.push("A");
    s.push("B");
    s.push("C");

    System.out.println("Next: " + s.peek());
  }
}

   
  








Related examples in the same category

1.new Stack()
2.new Stack < E > ()
3.Stack: empty()
4.Stack: push(E item)
5.Stack: pop()
6.Stack: search(Object o)