I have this code:
public static void main(String[] args) {
try {
String filePath = (args[0]);
BufferedReader br = new BufferedReader(new FileReader(filePath));
String strLine = br.readLine();
//Read File Line By Line and Print the content on the console
PrintStream out = new PrintStream(new FileOutputStream( //printing output to user specified text file (command line argument: outputfile)
args[1]+".txt"));
while ((strLine = br.readLine()) != null) {
char [] words = strLine.toCharArray();
System.out.println (strLine);
Arrays.sort(words);
out.println(words);
}
//close the streams
br.close();
}
catch(IOException e){
System.err.println("An IOException was caught, Re-open program and enter correct number of arguments :"+e.getMessage());
}
}
}
It does what I want it to do but it is skipping the first line of an input file.
Say for example the input file contained this list of words: bye red blue
it would output: edr belu
and skip printing: bey