Skip to content

Commit 490652a

Browse files
author
Ritik Bhushan Yadav
authored
Update InstanceCounter.java
1 parent 8287ff0 commit 490652a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/InstanceCounter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
public class InstanceCounter {
2-
private static int instances = 0;
3-
protected static int getInstances(){
2+
private static int instances = 0;//class Variable
3+
protected static int getInstances(){//return method
44
return instances;
55
}
6-
private static void setInstances(){
6+
private static void setInstances(){//value set method
77
instances++;
88
}
99
InstanceCounter(){
10-
InstanceCounter.setInstances();
10+
InstanceCounter.setInstances();//constructor to add instance
1111
}
1212

1313
public static void main(String[] args) {

0 commit comments

Comments
 (0)