Ejemplo n.º 1
0
  public static void main(String args[]) {

    Scanner sc = new Scanner(System.in);
    System.out.println("Please Enter a capacity");
    int value = sc.nextInt();

    Stack myStack = new Stack(value);

    myStack.push(5);
    myStack.push(10);

    myStack.pop();
    System.out.println(myStack.peek());
  }
 private String reverseStackRecursion(Stack s) {
   if (s.isEmpty() == true) return output;
   output = "" + s.pop() + reverseStackRecursion(s);
   return output;
 }
 private void fillStack(Stack s, String input) {
   for (int i = 0; i < input.length(); i++) {
     char ch = input.charAt(i);
     s.push(ch);
   }
 }