/* * StackExemplo.java * * Created on 13 de Maio de 2006, 14:51 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package calcpolonesa; import java.util.Scanner; /** * * @author meiadmin */ public class StackExemplo { /** * Creates a new instance of StackExemplo */ public StackExemplo() { } /** * @param args the command line arguments * public static void main(String[] args) { // TODO code application logic here Stack s = new Stack(5); // Pilha para 2 números. Scanner sc = new Scanner(System.in); for( int i=0; i<5; ++i) { System.out.println("Entre com o numero: "); int n = sc.nextInt(); s.push(n); //System.out.println(s.top()); } System.out.println(s.isFull()); // True for( int i=0; i<5; ++i) { System.out.println("topo= " + s.top()); s.pop(); } System.out.println(s.isEmpty()); // false System.out.println(s.isFull()); // false System.out.println("topo= " + s.top()); } */ }