Skip to content

Commit acd78c7

Browse files
committed
Made counter static and removed logging for production
1 parent 7966ffa commit acd78c7

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

Counter.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
package samples;
2-
3-
import sl4j.logger.log;
1+
package sample;
42

53
public class Counter {
6-
private int value;
4+
private static int value = 0;
75

8-
public Counter() {
9-
this.value = 0;
10-
log.log("Counter created");
11-
}
6+
/**
7+
*
8+
* @return Counter instance
9+
*/
10+
private Counter() {}
1211

13-
public int increment(){
14-
return ++this.value;
12+
/**
13+
*
14+
* @return counter value
15+
*/
16+
public static int increment(){
17+
return ++value;
1518
}
1619

17-
public int reset(){
18-
return this.value = 0;
20+
public static void reset(){
21+
value = 0;
1922
}
2023
}

0 commit comments

Comments
 (0)