class Res
{
String name;
String sex;
boolean f = false;
}
class Input implements Runnable
{
private Res s;
Input(Res s)
{
this.s = s;
}
public void run()
{
int i = 0;
while(true)
{
synchronized(s)
{
System.out.println(s.name+"..."+s.sex);
s.f = false;
try{s.notifyAll();}catch(Exception e){}
}
}
}
}
public class WaitNotifyDemo
{
public static void main(String[] args)
{
Res s = new Res();
new Thread(new Input(s)).start();
new Thread(new Output(s)).start();
}
}