I have this code
public class program {
public static void main(String[] args) {
try {
String filePath = (args[0]);
String st
Don't create a new PrintStream
in each loop. Instead create the PrintStream
prior to the while loop:
PrintStream out = new PrintStream( ... );
while ((strLine = br.readLine()) != null) {
out.print(strLine);
}
Because you are overwriting to the same file within the loop. Create the PrintStream outside of the loop not inside the loop and it should write all lines!