java 从stdin中读取数据

import java.io.*;


public class read_stdin{
    public static void main(String[] args) {
        DataInputStream in = new DataInputStream(new BufferedInputStream(System.in));
        String s;
        try {
            while((s = in.readLine()).length() != 0)
                System.out.println(s);
            //An empty line terminates the program
        } catch(IOException e) {
            e.printStackTrace();
        }
    }
}

你可能感兴趣的:(java,java,java)