Consider this:
Then add this to the beginning of the execute method:
Now everytime you execute System.out.println(
String) the current thread will sleep for 10 seconds. It will still work, for now, but later when you remove that rather innocent looking println in TestRun it will break. Why? Because now Test will be sleeping for 10 seconds when it executes the println and TestRun won't be. As a result Test will execute wait() after TestRun executes notify() and it will be waiting forever. A rather naive example I know, but hopefully it gets the point across. Don't rely on thread A executing X before thread B executes Y unless you've properly synchronized them so that it's guaranteed, otherwise you end up with race conditions.