public class MyGeneric <T extends Collections> {
T x;
MyGeneric(T x) {
this.x = x;
}
public static void main(String[] str) {
List<String> arrayList = new ArrayList<String>();
MyGeneric<?> test = new MyGeneric<List<String>>(arrayList); //此行出错,啥原因?
}
}
T x;
MyGeneric(T x) {
this.x = x;
}
public static void main(String[] str) {
List<String> arrayList = new ArrayList<String>();
MyGeneric<?> test = new MyGeneric<List<String>>(arrayList); //此行出错,啥原因?
}
}
T x;
MyGeneric(T x) {
this.x = x;
}
public static void main(String[] str) {
List<String> arrayList = new ArrayList<String>();
MyGeneric<?> test = new MyGeneric<List<String>>(arrayList); //ok
}
}