import java.util.Scanner; import java.io.*; public class CopyInput { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String fileName = "input.txt"; PrintWriter pr = null; try { pr = new PrintWriter(fileName); String str; while((sc.hasNextLine())) { str = sc.nextLine(); //System.out.println(str); pr.println(str); } pr.flush(); } catch (IOException e) { e.printStackTrace(); } finally{ if(pr != null) pr.close(); } } }