1).At any point of time, main thread and thread b can be in their respective synchronized blocks at the same time (coz even though both the threads have their lock on object b, both are methods of different classes).
Don't know what you mean by this, but yes, both can be within the block -- but only one is holding the lock. The wait() method releases the lock, which allows another thread to acquire and enter the sync block.
2).once the main thread encounters the wait method, it comes out of the synchronized block
No. The wait() method releases the lock. This isn't exactly "comes out of the synchronized block".
and then whatever is left in the main method is executed only after it is notified right? It does not go into the synchronized block again right?
When a notification occurs, the wait() method will be woken up.... but it will need to reacquire the locks again before it can return from the wait() method.
Henry