jtentor icon

DemoStack3 - Java - main

jtentor | PRO | 05/10/20 03:54:12 PM UTC | 0 ⭐ | 1159 👁️ | Never ⏰ | []
Java |

580 B

|

None

|

0 👍

/

0 👎

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());
        }
    }
 
}

Comments