1.泛型的向上限定和向下限定
import java.util.ArrayList;
import java.util.Collection;
class Animal {
}
class Dog extends Animal {
}
class Cat extends Animal {
}
class GenericDemo {
public static void main(String[] args) {
Collection<Object> c1 = new ArrayList<Object>();
Collection<Animal> c2 = new ArrayList<Animal>();
//? super Animal:向上限定Animal及其子类。
Collection<? super Animal> c3 = new ArrayList<Object>();
Collection<? super Animal> c4 = new