Java txt File from FileWriter is empty

前端 未结 2 926
长发绾君心
长发绾君心 2020-12-11 10:53

I have trouble with write txt file from class FileWrite in my java project , if the PRINT() method were in VehicleCollection class , and called in main class - don\'t have p

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-11 11:04

    File writes are usually buffered by the operating system. You must either close() or flush() the writer to make sure that the changes go to disk. If you're done with the file, just close it. A close will automatically flush the buffers.

提交回复
热议问题