Sunita,
First lets talk about the trivia. The 'if' construct does the check only once where as the 'while' construct can be used to achive repitition as well as decision making.
Usually the while loops are used in programs when you want to 'poll' for something. For example,
Here the IssueTickets() is repeatedly invoked till the while condition returns false.
In the context of threads, the wait(), notify() and notifyAll() methods are used to achieve synchronization. That means there are two( or more ) interdependent tasks which start or stop based on an object state. Here it not only becomes important to keep track of the objec state that triggers off various paths of execution, it also becomes important to repeatedly 'inquire' for the correct object state. That is the
polling I was referring to which is achieved by the use of while loop.
Okay, okay, I know I am sounding too theoretical. So let me give you some homework
Read the
Java Tutorial about
Thread Synchronization . It is everything you need to know presented so well, you won't need another book.
Good luck( and
Ajith