0

I want to make it possible to invoke this method several times, but with a delay of 10 seconds.

public void addBottle (Pant newBottle)
{
    if (pantList.size() == MAXKAPACITY) {
        System.out.println("machine is full, please contact service");
    }
    else {
        pantList.add(newBottle);
    }
}
rtruszk
  • 3,902
  • 13
  • 36
  • 53
unitylol
  • 1
  • 2
  • 1
    So you want to call `addBottle` or any other method at regular interval, but you don't know how, and you don't have a single line of code for the timer aspect... have you [really searched](http://stackoverflow.com/questions/4544197/how-do-i-schedule-a-task-to-run-at-periodic-intervals)? – mins May 20 '15 at 17:53

1 Answers1

0
while(someCondition) {
   addBottle(x);
   Thread.sleep(10000);
}
alsdkjasdlkja
  • 1,260
  • 2
  • 14
  • 30