日期:2014-05-19 浏览次数:20918 次
package com.thinkinjava.chapter8; public class ReferenceCounting { public static void main(String[] args) { Shared s1=new Shared(); s1.dispose(); } } class Shared{ private int refcount=0; private static long counter=0; private final long id=counter++; public Shared(){ System.out.println("Createing "+this); } }