标题:大家帮我看看这个程序有会么问题。
取消只看楼主
jackface
Rank: 2
等 级:论坛游民
帖 子:63
专家分:17
注 册:2009-4-15
结帖率:93.75%
已结贴  问题点数:20 回复次数:1 
大家帮我看看这个程序有会么问题。
package ConsoleApplication1;
import *;
import java.util.*;

class Sender extends Thread{
    private PipedOutputStream out = new PipedOutputStream();
    public PipedOutputStream getPipedOutputStream() {
        return out;
    }


public void run(){
  try{
   for(int i=-127;i<=128;i++){
   out.write(i);
       yield();
   }
out.close();
}catch(Exception e){
   throw new RuntimeException(e);
}
}
}

public class Receiver extends Thread {
private PipedInputStream in;
public Receiver(Sender sender) throws IOException{
    in = new PipedInputStream(sender.getPipedOutputStream());
}
    public void run() {
    try{
        int date;
        while((date=in.read())!=-1)
        System.out.println(date);
            in.close();
        }catch(Exception e){
        throw new RuntimeException(e);
        }
}
    public static void main(String args[])throws Exception {
        Sender sender = new Sender();
        Receiver reveiver = new Receiver(sender);
        sender.start();
        reveiver.start();

    }
}


搜索更多相关主题的帖子: class void private package public 
2010-02-13 21:57
jackface
Rank: 2
等 级:论坛游民
帖 子:63
专家分:17
注 册:2009-4-15
得分:0 
不知道为什么在Viusal studio2005下编译就有问题。
2010-02-14 11:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-297647-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.113692 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved