/* Testauto.java */ public class Testauto { static private int objcnt = 0; public Testauto() { ++objcnt; } public void finalize() { --objcnt; } public static void main(String[] args) { Testauto auto1; Testauto auto2 = new Testauto(); System.out.println( "Anzahl Testauto-Objekte: " + Testauto.objcnt ); } }