import java.io.*;
public class PipeStreamTest
{
public static void main (String[] args) {
try
{
Thread t1=new Sender();
Thread t2=new Receiver();
PipedOutputStream out=t1.getOutputStream();//问题行
PipedInputStream in=t2.getInputStream();//问题行
out.connect(in);
t1.start();
t2.start();
}
catch(IOException e)
{
System.out.println (e.getMessage());
}
}
}
class Sender extends Thread
{
private PipedOutputStream out=new PipedOutputStream();
public  PipedOutputStream getOutputStream()
{
return out;
}
public void run()
{
String s=new String("hello,receiver,how are you");
try
{
out.write(s.getBytes());
out.close();
}
catch(IOException e)
{
System.out.println (e.getMessage());
}
}
}
class Receiver extends Thread
{
private PipedInputStream in=new PipedInputStream();
public PipedInputStream getInputStream()
{
return in;
}
public void run()
{
String s=null;
byte []buf=new byte[1024];
try
{
int len=in.read(buf);
s=new String(buf,0,len);
System.out.println ("the following message comes from sender:\n"+s);
in.close();
}
catch(IOException e)
{
System.out.println (e.getMessage());
}
}
}我标的问题行编译总是找不到符号
--------------------Configuration: <Default>--------------------
E:\java\chapter7\PipeStreamTest.java:9: 找不到符号
符号: 方法 getOutputStream()
位置: 类 java.lang.Thread
            PipedOutputStream out=t1.getOutputStream();//PipedOutputStream out=t1.getOutputStream();
                                    ^
E:\java\chapter7\PipeStreamTest.java:10: 找不到符号
符号: 方法 getInputStream()
位置: 类 java.lang.Thread
            PipedInputStream in=t2.getInputStream();
                                  ^
2 错误Process completed.