将标准输入和输出分配给InputStream和OutputStream
/** nowjava 提供 **/ import java.io.*; public class Main { public static void main(String[] args) { System.out.println("type:"); InputStream in = System.in; OutputStream out = System.out; try { int input = in.read(); System.out.println(input); out.write(input); out.close();//from 时代Java公众号 - N o w J a v a . c o m } catch(IOException e) { e.printStackTrace(); } } }