/home/caleb/ASDV-Java/Semester 3/Assignments/lab6_generics_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab6_generics_calebfontenot/WildCardWithSuper.java |
package edu.slcc.asdv.caleb.lab6_generics_calebfontenot;
public class WildCardWithSuper {
public static <T> void add(GenericStack<T> stack1, GenericStack<? super T> stack2) {
while(!stack1.isEmpty()) {
stack2.push(stack1.pop());
}
}
public static void main(String[] args) {
GenericStack<String> stack1 = new GenericStack<>();
GenericStack<Object> stack2 = new GenericStack<>();
stack2.push("one");
stack2.push(2);
stack1.push("one");
add(stack1, stack2);
WildCard2.print(stack2);
}
}