public class InputOutputDemo
{
public static void main(String[] args)
{
Res r=new Res();
Input in=new Input(r);
Output out=new Output(r);
Thread t1=new Thread(in);
Thread t2=new Thread(out);
t1.start();
t2.start();
}
}
class Res
{
String name;
String sex;
boolean b=true;
}
class Input implements Runnable
{
private Res s;
public Input(Res s)
{
this.s=s;
}
public void run()
{
int x=0;
int count=0;
while(true)
{
synchronized (s) {