Untitled

 avatar
unknown
java
2 years ago
238 B
7
Indexable
public class CounterWithLimit{
    private int counter = 0;
    private int limit;

    public CounterWithLimit(int limit){
        this.limit = limit;
    }

    public void IncreaseBy1(){
        counter = (counter + 1) % limit;
    }
}
Editor is loading...
Leave a Comment