import java.io.*; // read each line from input file and write it to the output file // the names of input and output are given as program parameters // assume the input file has two lines in it public class FileIO { public static void main (String[] argv) throws Exception { String line1 = new String(); String line2 = new String(); File f = new File(argv[0]); // input file File outf = new File(argv[1]); // output file FileOutputStream fs = new FileOutputStream(outf); PrintStream p = new PrintStream(fs); FileInputStream ifs = new FileInputStream(f); InputStreamReader isr = new InputStreamReader(ifs); BufferedReader r = new BufferedReader(isr); line1 = r.readLine(); line2 = r.readLine(); p.println(line1); p.println(line2); r.close(); p.close(); } // end of main() } // end of FileIO