Please look through code below:
// A.class File file = new File(\"blah.txt\"); FileWriter fileWriter = new FileWriter(file); PrintWriter printWriter = new P
BufferedWriter - Writes text to an output character stream, buffering characters from a character stream. PrintWriter - Prints formatted representations of objects to a text output stream.