demostatic.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 16 行

JAVA
16
字号
public class DemoStatic
{
        public static void main(String args[])
        {
                StaticEmployee s1 = new StaticEmployee("Bob", 1, "Saskatoon");
                StaticEmployee s2 = new StaticEmployee("Chris", 2, " Regina");
                System.out.println("Number of employees: " + s1.numEmployees);
                StaticEmployee s3 = new StaticEmployee("George", 3, "North Battleford");
                System.out.println("Number of employees: " + StaticEmployee.numEmployees);

		s2 = null;
		System.gc(); // force garbage collection to run
		System.out.println("Number of employees: " + StaticEmployee.numEmployees);
        }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?