Java writing to a deleted file

后端 未结 3 1989
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 08:16

I\'m using FileWriter to write to a file and noticed that even after I have deleted the file (out of process) the FileWriter does not throw any exception.

Is this no

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-04 08:41

    Yes, it's normal. Using most of the conventional ways of doing I/O, if the file doesn't exist, it creates it for you. This of course pending that you deleted it before you began writing to it.

提交回复
热议问题