title: How can I set a command to run in an interval in Java?
body: <p>This is a simple game:
  - Bee gets some honey from the flower's nectar.
  - The nectar gets empty but needs to automatically refill honey.
  - There are 5 stages of the honey refill [smallest drop of honey-biggest]</p>
  
  <p>Question: How can I set a command to automatically refill honey on the nectar? With a 5 second interval on each honey refill stage?</p>
  
  <p>So far, I have this code, but it is stuck with the first stage of honey refill. I need the drops of honey to grow.</p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>    public void update() {
        timer++;
  
          if (isEmpty) {
              if (timer &gt;= 300 /* 60*5초 */) {
                  sx = 0;
                  sx += w; 
                  timer = 0;
                  System.out.println("꿀참");
              }
          }
          isEmpty = false;
      }
  </code></pre>