I have some codes like this:
PrintWriter pw = new PrintWriter(new BufferedReader(....));
for(int i=0; i<10; i++) {
pw.println("a");
pw.flush();// flush each time when println()?
}
pw.close();
Is the flush() in each 'for' statement necessarily? I heard that flush() would auto invoke when invoke close() . If I write code like this:
PrintWriter pw = new PrintWriter(new BufferedReader(....), true);
and I wouldn't write pw.flush() anymore? Thanks.