There was an error while loading. Please reload this page.
1 parent 8287ff0 commit 490652aCopy full SHA for 490652a
src/InstanceCounter.java
@@ -1,13 +1,13 @@
1
public class InstanceCounter {
2
- private static int instances = 0;
3
- protected static int getInstances(){
+ private static int instances = 0;//class Variable
+ protected static int getInstances(){//return method
4
return instances;
5
}
6
- private static void setInstances(){
+ private static void setInstances(){//value set method
7
instances++;
8
9
InstanceCounter(){
10
- InstanceCounter.setInstances();
+ InstanceCounter.setInstances();//constructor to add instance
11
12
13
public static void main(String[] args) {
0 commit comments