pls help me out
1. class : MainClass
import java.io.*;
publicclass MainClass
{
publicstaticvoid main(String s[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
new Reader1(in).start();
new Reader2(in).start();
}
}
2. class : Reader1
import java.io.*;
publicclass Reader1extends Thread
{
DataInputStream din;
public Reader1(DataInputStream in)
{
super("Thread 1");
din=in;
}
publicvoid run()
{
String str;
try
{
while((str=din.readLine())!=null)
System.out.println("reader1 :"+str);
}
catch(IOException e)
{e.printStackTrace();System.exit(1);}
}
}
3. class : Reader2
import java.io.*;
publicclass Reader2extends Thread
{
DataInputStream din;
public Reader2(DataInputStream in)
{
super("Thread 2");
din=in;
}
publicvoid run()
{
String str;
try
{
while((str=din.readLine())!=null)
System.out.println("reader2 :"+str);
}
catch(IOException e)
{e.printStackTrace();System.exit(1);}
}
}
what change i need to make to the above code so that input is read by both the threads...
Answer to this question will help me in my project where i've a similar situation

