package VL13.Aufgabe01; import java.util.Stack; /** * Vorlesung 13 / Aufgabe 1 * * @author Sebastian Brosch */ public class Aufgabe01 { public static void main(String[] args) { // Integer Stack System.out.printf("\n%s:\n", "Integer Stack"); IntegerStack integerStack = new IntegerStack(); integerStack.push(7); integerStack.push(3); integerStack.push(8); integerStack.push(2); System.out.println(integerStack.pop()); System.out.println(integerStack.pop()); integerStack.push(7); System.out.println(integerStack.pop()); System.out.println(integerStack.pop()); // Generic Stack (Integer) System.out.printf("\n%s:\n", "Generic Stack (Integer)"); GenericStack gIntegerStack = new GenericStack(); gIntegerStack.push(7); gIntegerStack.push(3); gIntegerStack.push(8); gIntegerStack.push(2); System.out.println(gIntegerStack.pop()); System.out.println(gIntegerStack.pop()); gIntegerStack.push(7); System.out.println(gIntegerStack.pop()); System.out.println(gIntegerStack.pop()); // Generic Stack (String) System.out.printf("\n%s:\n", "Generic Stack (String)"); GenericStack gStringStack = new GenericStack(); gStringStack.push("Hallo"); gStringStack.push("Welt"); gStringStack.push("!"); System.out.println(gStringStack.pop()); System.out.println(gStringStack.pop()); System.out.println(gStringStack.pop()); // Stack (Integer) System.out.printf("\n%s:\n", "Stack (Integer)"); Stack nIntegerStack = new Stack(); nIntegerStack.push(7); nIntegerStack.push(3); nIntegerStack.push(8); nIntegerStack.push(2); System.out.println(nIntegerStack.pop()); System.out.println(nIntegerStack.pop()); nIntegerStack.push(7); System.out.println(nIntegerStack.pop()); System.out.println(nIntegerStack.pop()); // Stack (String) System.out.printf("\n%s:\n", "Stack (String)"); Stack stringStack = new Stack(); stringStack.push("Hallo"); stringStack.push("Welt"); stringStack.push("!"); System.out.println(stringStack.pop()); System.out.println(stringStack.pop()); System.out.println(stringStack.pop()); } }