Write file using BufferedWriter in Java [duplicate]
问题 This question already has answers here : BufferedWriter not writing everything to its output file (8 answers) Closed 4 years ago . I am doing a lab where we have to read in an external file, take some statistics on the data, and then create and write a new file with the stats. Everything in my program works except for writing the file, which I cannot understand why my method won't work. BufferedWriter writer; public void writeStats(int word, int numSent, int shortest, int longest, int average