?? countinstances.java
字號:
public class CountInstances {
private static int numInstances = 0;
protected static int getNumInstances() {
return numInstances;
}
private static void addInstance() {
numInstances++;
}
CountInstances() {
CountInstances.addInstance();
}
public static void main(String[] arguments) {
System.out.println("Starting with " +
CountInstances.getNumInstances() + " instances");
for (int i = 0; i < 10; ++i)
new CountInstances();
System.out.println("Created " +
CountInstances.getNumInstances() + " instances");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -