Think so that I have one class like this.
Class myclass ()
int I =10;
Here some client r calling and using this class. For each and every client call it will creates one instance now just I want one thing that how can I get count for that instance for myclass.
Originally posted by Ernest Friedman-Hill:
Welcome to JavaRanch!
Add a static int member to the class. In each constructor, increment this variable. The variable will then represent the total number of objects created. You may also want a static "getCount()" method to fetch that info.