hii all ..plz can any body help me in writing a java program that solve a public pathroom problem(a sharing pathroom for boys and girls in which no both of them can appear at the same time in the pathroom ) the program must solve the problem and synchronize between them ....plzzz help

Sounds like a neat problem to do. We aren't allowed to give anyone homework help unless they show some effort. If you do, we will be more than happy to help out. In the mean time, look up synchronizing threads. I've done a problem similar to this where two people share a bank account, so if you show a little effort I can surely help you.