// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
package test;

import java.io.Serializable;

import javax.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class C implements Serializable {
    private static int total = 0;
    private int n;
    public C() {
        total++;
        n = total;
        System.out.println("One C created");
    }
    @Override
    public String toString() {
        return n + " of " + total;
    }
    @Override
    public void finalize() {
        System.out.println("One C destroyed");
    }
}
