标题:请大家帮我找出这些的注释下
只看楼主
zhisenhu
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-8-9
 问题点数:0 回复次数:0 
请大家帮我找出这些的注释下
import *;
import *;

public class client2 {
    public static void main(String args[]){
        try {
        Socket s = new Socket("127.0.0.1", 6666);
        Runnable userInput = new keyboardIn(s);
        Runnable serverInput = new serverIn(s);
        Thread t1 = new Thread(userInput);
        Thread t2 = new Thread(serverInput);
        t1.start();
        t2.start();
        //s.close();
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
}

class keyboardIn implements Runnable {
    Socket s;
    public keyboardIn(Socket s) {
        this.s = s;
    }

    public void run() {
        try {
            BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
            PrintWriter out = new PrintWriter(s.getOutputStream(),true);
            String line = null;
            while((line = input.readLine()) != null){
                out.println(line);
                if("exit".equals(line)){
                    break;
                }
            }
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}

class serverIn implements Runnable {
    Socket s;
    public serverIn(Socket s) {
        this.s = s;
    }
   
    public void run() {
        try {
        BufferedReader bufr = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line = null;
        while((line = bufr.readLine()) != null){
            System.out.println("督昢傷ㄩ"+line);
            }
        }catch(IOException e){
            e.printStackTrace();
        }
    }
搜索更多相关主题的帖子: void Socket public import 
2012-08-09 18:11



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




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

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