If I keep calling wait(1000) on a thread, does that make it wait longer or is it going to wait only 1000 milli-seconds?
I mean if I call it the first time and then a second time, would that make it wait 2000 milli-seconds or just 1000?
If I keep calling wait(1000) on a thread, does that make it wait longer or is it going to wait only 1000 milli-seconds?
I mean if I call it the first time and then a second time, would that make it wait 2000 milli-seconds or just 1000?
A call to Object.wait(int millis) blocks execution for at most n milliseconds. A second call blocks again for at most the respective time, hence,
obj.wait(1000);
obj.wait(1000);
makes your program wait for at most 2 seconds. Read the JavaDoc to see under which conditions the time can be shorter.
However, I'm not sure you really want to use wait(). Read about the intended usage of wait(). Maybe you should have a look at Thread.sleep(int millis). I thinks this could be what you actually want to use.