Untitled

Anonymous
java
11/16/2023 11:07 PM
320 B
33
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