How to Flush a Buffered Reader in Java
The "PrintWriter" statement flushes the buffered reader in the Java language. Java has a buffer that contains the information you want to output to the user. It continues to fill up and store the information in the computer' memory. When you use the "PrintWriter" command in Java, the buffer flushes and the memory releases the information stored.
Instructions
-
-
1
Open your Java editor and the project you want to edit. Double-click the source code file you want to use to flush the buffer.
-
2
Create a variable that points to the PrintWriter class. You must define the variable before you can execute the methods and properties. Add the following code to the source code file:
PrintWriter print = new PrintWriter(System.out, true);
-
-
3
Write the data to the user's screen and flush the buffer. The following code displays the buffer's data to the screen:
print.println();
-
1