30 lines
746 B
Java
30 lines
746 B
Java
|
package generics;
|
||
|
|
||
|
public class Main {
|
||
|
|
||
|
public static void main(String[] args) {
|
||
|
|
||
|
|
||
|
var simplestack1 = new SimpleStack<String>(5);
|
||
|
|
||
|
simplestack1.push("Hallo");
|
||
|
simplestack1.push("das ist ein Beispiel für");
|
||
|
simplestack1.push("einen SimpleStack.");
|
||
|
simplestack1.push("Logisch wird alles in ");
|
||
|
simplestack1.push("verkehrter Reihenfolge ausgegeben.");
|
||
|
|
||
|
for (int i = simplestack1.getSize(); i > 0 ; i--) {
|
||
|
System.out.print(simplestack1.pop() + "| |");
|
||
|
}
|
||
|
|
||
|
var extstack1 = new ExtStack<String>(2);
|
||
|
|
||
|
extstack1.push("Hallo");
|
||
|
extstack1.push("Hello");
|
||
|
|
||
|
System.out.println(extstack1.peek());
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|