Note: (Restricted functionality due to obvious reasons!)
Minimal Code ( Raw-View ) :
class C1
{
static int oCounter; // This variable is shared by all objects of this class
C1()
{
oCounter++;
}
}
class ObjCounter
{
public static void main(String z[])
{
C1 obj1 = new C1();
C1 obj2 = new C1();
C1 obj3 = new C1();
System.out.println("Totol Objects created = "+C1.oCounter);
}
}