I am receiving an error message for the parameter of my while loop. I do not understand why. I have initialized all the variables in the parameter. The program reads most of my input file but only prints about half of the output file, and it stops the output in the middle of a read line.
The error is:
Exception in thread "main" java.lang.NullPointerException
at dbreadfile.DBReadFile.main(DBReadFile.java:44)
Java Result: 1
The program is:
PrintWriter pw;
BufferedWriter bw;
FileWriter fw;
String line = "";
br = new BufferedReader(new FileReader(inFile));
fw = new FileWriter(outFile, true);
bw = new BufferedWriter(fw);
pw = new PrintWriter(bw);
while((line = br.readLine().trim()) != null){ //ERROR ON THIS LINE
//do stuff
}//end while