1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.Scanner; public class Main { public static void main( String [] args)throws FileNotFoundException { FileInputStream fis = new FileInputStream( "input.txt" ); System.setIn(fis); PrintStream ps = new PrintStream( new FileOutputStream( "output.txt" )); System.setOut(ps); Scanner cin= new Scanner(System. in ); int n; while (cin.hasNext()) { n=cin.nextInt(); System.out.println(n); } } } |
java 重定向
2015年12月03日 20:11