标签:isp exce catch http pac .com images 代码 exti
用Scanner输入,用PrintStream输出
功能:从in.txt读入,输出到out.txt
代码:
1 package ioTest; 2 3 import java.io.*; 4 import java.util.Scanner; 5 6 public class TestMain { 7 8 public static void main(String[] args) { 9 try { 10 Scanner sc=new Scanner(new File("in.txt")); 11 PrintStream ps=new PrintStream("out.txt"); 12 while(sc.hasNext()){ 13 int a=sc.nextInt(); 14 System.out.print(a+" "); 15 ps.println(a); 16 } 17 18 } catch (Exception e) { 19 e.printStackTrace(); 20 } 21 } 22 23 }
结果:
标签:isp exce catch http pac .com images 代码 exti
原文地址:http://www.cnblogs.com/Renyi-Fan/p/7613220.html