标准的输入输出流
InputStream in = System.in
PrintStream out = Syste.out
PrintStream out = Syste.out
InputStream in = System.in
PrintStream out = Syste.out
程序示例
InputStream in = System.inpublic static void main(String[] args) throws IOException {
//标准输入流
//Java的装饰者模式 使用BufferedReader进行装饰
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) ;
System.out.println("请输入一个字符串:");
String line = br.readLine() ;
System.out.println("您输入的字符串是:"+line);
System.out.println("请输入一个整数:");
String str = br.readLine() ;
int num = Integer.parseInt(str) ;
System.out.println("输入的整数是:"+num);
}
PrintStream out = Syste.out
public static void main(String[] args) throws IOException {
System.out.println("我的一");
System.out.println("-------------");
PrintStream ps = System.out ;
//PrintStream的功能
//public void println(String x)
ps.println("我的二");
ps.println();
// ps.print() ;没有该功能
System.out.println("---------------------------");
//Java的装饰者模式 使用BufferedWrider进行装饰
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)) ;
bw.write("hello");
bw.newLine();
bw.write("world");
bw.newLine();
bw.write("java");
bw.newLine();
bw.flush();
bw.close();
}