?? collectionclassifier.java
字號:
// Broken - incorrect use of overloading! - Page 128
import java.util.*;
public class CollectionClassifier {
public static String classify(Set s) {
return "Set";
}
public static String classify(List l) {
return "List";
}
public static String classify(Collection c) {
return "Unknown Collection";
}
public static void main(String[] args) {
Collection[] tests = new Collection[] {
new HashSet(), // A Set
new ArrayList(), // A List
new HashMap().values() // Neither Set nor List
};
for (int i = 0; i < tests.length; i++)
System.out.println(classify(tests[i]));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -