// program for count number of objects
class count
{
private static int cnt;
public count()
{
cnt++;
}
public static void show()
{
System.out.println("Objects are :="+cnt);
}
}
class CountObj
{
public static void main(String []args)
{
count c1=new count();
count c2=new count();
count c3=new count();
count.show();
}
}
class count
{
private static int cnt;
public count()
{
cnt++;
}
public static void show()
{
System.out.println("Objects are :="+cnt);
}
}
class CountObj
{
public static void main(String []args)
{
count c1=new count();
count c2=new count();
count c3=new count();
count.show();
}
}
No comments:
Post a Comment