The "this" keyword refers to the current instance of the class in which it appears. In your case, it is the current instance of class TthrA.
You can synchronise on any object. However, choosing the correct object for a particular situation is not trivial. Perhaps
you should work through a good on-line tutorial or book (e.g. "Java Threads") on
Java threading.
In your case, the code appears simply to be trying to demonstrate the wait() and notify() concepts. In that case, it doesn't matter too much which object you choose to synchronise on, providing that the wait() and notify() synchronise on the same object.
However, your code is not "perfect". In fact, it has at least two threading bugs in it.
You are not synchronised before you start the thread; this means that the notification might occur before your start waiting, in which case you'll miss it and wait forever. This is a serious error. You have no protection against "spurious wakeup". All waiting threads can, in theory, get woken up by the system, rather than by a notify(). Therefore, waiting should always be done in a loop, and some shared field (or similar) should be used to allow the waiting and notifying threads to agree on whether a notification happened. This is a somewhat more arcane bug and you may choose to ignore it, while in the early stages of learning. However, you should revisit it, as it could bite you one day. [ December 19, 2007: Message edited by: Peter Chase ]