jtentor icon

Stack (en Java) de Estructura de Datos - Demo1.java

jtentor | PRO | 09/20/20 02:14:14 PM UTC | 0 ⭐ | 1747 👁️ | Never ⏰ | []
Java |

610 B

|

None

|

0 👍

/

0 👎

//
// Created by Julio Tentor <[email protected]>
//
 
public class Demo1 {
 
    public void Run() {
 
        System.out.println("Demo de Stack (Estructura de Datos)");
 
        Stack<Character> miPila = new Stack<Character>();
 
        miPila.push('a');
        miPila.push('b');
        miPila.push('c');
 
        System.out.println("miPila: " + miPila);
 
        while (!miPila.empty()) {
            System.out.println(miPila.pop());
        }
 
        try {
            System.out.println(miPila.peek());
        } catch (Exception e){
            System.out.println(e);
        }
    }
}
 

Comments