package standardIO;
import java.io.File;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.Scanner;
//标准输出输出流 和扫描器
public class StandardIODemo {
public static void main(String[] args) throws Exception {
//标准输出重定向
System.setOut(new PrintStream(new File("process/system.txt")));
//标准输入重定向
System.setIn(new FileInputStream("process/WriterDemo.txt"));
System.out.println("-------begin----");
Scanner input =new Scanner(System.in);
while(input.hasNextLine()){
System.out.println(input.nextLine());
}
input.close();
System.out.println("-------end----");
}
}
import java.io.File;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.Scanner;
//标准输出输出流 和扫描器
public class StandardIODemo {
public static void main(String[] args) throws Exception {
//标准输出重定向
System.setOut(new PrintStream(new File("process/system.txt")));
//标准输入重定向
System.setIn(new FileInputStream("process/WriterDemo.txt"));
System.out.println("-------begin----");
Scanner input =new Scanner(System.in);
while(input.hasNextLine()){
System.out.println(input.nextLine());
}
input.close();
System.out.println("-------end----");
}
}