wait() and notify() are called on objects not threads.
And, these both can be called from within synchronized code.
In a plain English, wait() for a current
thread means that "it's not my time to do things, let's go for a cup of coffe until I get notified" while notify() means "hey, let's get back to work"
More technical explanation:
when thread obtains lock on an object (gets into block of synchronized code) no other thread can get there at the same time. If you want this thread to wait for something (eg. some field value is not set yet) you call wait() on the Object (not thread, check java.lang.Object in API) what means that current thread is not a lock owner anymore and other threads can enter synchronized code to do things. When notify() is called all waiting threads compete to get object's lock and which is lucky no one can predict.