/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package jfile; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { File inputFile = new File("inputFileName.txt"); Scanner in = new Scanner(inputFile); PrintWriter out = new PrintWriter("outputFileName.txt"); int lineNumber = 1; while ( in.hasNextLine() ) { String line = in.nextLine(); out.println("/* " + lineNumber + " */ " + line); lineNumber++; } out.close(); } }