Advertisement
Eduardo_Pires

Main Pilha java

Nov 14th, 2022
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. public class Main
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.        Pilha p =  new Pilha(10);
  6.        char c;
  7.  
  8.        p.empilhar('a');
  9.        p.empilhar ('b');
  10.        p.empilhar ('c');
  11.        p.empilhar ('d');
  12.        p.empilhar ('e');
  13.        p.empilhar ('f');
  14.        p.empilhar ('g');
  15.        p.desempilhar();
  16.        p.empilhar ('i');
  17.        p.empilhar ('j');
  18.        p.empilhar ('k');
  19.  
  20.        while(!p.vazia())
  21.        {
  22.            c = p.desempilhar();
  23.            System.out.println(c);
  24.        }
  25.  
  26.        p.destruir();
  27.     }
  28. }
Tags: source code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement