Reading from file
Heres the codez:publicvoid readWrite(){
try{
File file =new File("fileWrite2.txt");
PrintWriter fw =new PrintWriter(file);
BufferedWriter bf =new BufferedWriter(fw);
bf.write("line 1");
bf.newLine();
bf.write("line 2");
bf.newLine();
bf.write("line 3");
bf.newLine();
bf.flush();
bf.close();
FileReader fr =new FileReader(file);
BufferedReader br =new BufferedReader(fr);
do{
System.out.println(br.readLine());
}while (br.readLine() !=null);
}catch (Exception ioe){
System.out.println("IOException");
}
}
As you can see I write to a file then try to read it. Now how, I ask you, could I go through the file and print out each line ?
The output at the moment is as follows : line 1
line 3
line 2 is AWOL, I know the problem is somewhere in that while loop but how do loop through the lines of the file ?

