How do you add a counter in Java?

You can do a static int counter = 0; And whenever you do System. out. println(“Move disc from “+a+” to “+b); in Han(…) you can add counter++; below that.

Sizin İçin Seçtik  What is difference between primitive and object in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *