Skip to content

Instantly share code, notes, and snippets.

@Krisztiaan
Created December 5, 2017 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krisztiaan/104105d456f5fea7de81b09c2348e3e2 to your computer and use it in GitHub Desktop.
Save Krisztiaan/104105d456f5fea7de81b09c2348e3e2 to your computer and use it in GitHub Desktop.
public class CounterClass {
private static counter = 0;
public static int getInstanceCount() {
return CounterClass.counter;
}
// final, ha leszármazunk belöle, akkor is muszáj legyen számolnia
public final CounterClass() {
CounterClass.counter++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment