以下代码执行的结果是多少()? public class Demo {
public static void main(String[] args) {
Collection>[] collections =
{new HashSet(), new ArrayList(), new HashMap().values()};
Super subToSuper = new Sub();
for(Collection> collection: collections) {
System.out.println(subToSuper.getType(collection));
}
}
abstract static class Super {
public static String getType(Collection> collection) {
return “Super:collection”;
}
public static String getType(List> list) {
return “Super:list”;
}
public String getType(ArrayList> list) {
return “Super:arrayList”;
}
public static String getType(Set> set) {
return “Super:set”;
}
public String getType(HashSet> set) {
return “Super:hashSet”;
}
}
static class Sub extends Super {
public static String getType(Collection> collection) {
return "Sub"; }
}
}
https://gw-c.nowcoder.com/api/sparta/jump/link?link=https%3A%2F%2Fwww.nowcoder.com%2FquestionTerminal%2F5dbdf7b89d9a4c27908a8c5c1e88c2fe