Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Stack;
- public class DemoStack3 {
- public static void main(String[] args) {
- System.out.println("Demo de Stack");
- Stack<Character> miPila = new Stack<Character>();
- miPila.push('a');
- miPila.push('b');
- miPila.push('c');
- System.out.println(miPila.pop());
- System.out.println(miPila.pop());
- System.out.println(miPila.pop());
- try {
- System.out.println(miPila.peek());
- } catch (Exception e){
- System.out.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement