Writing a string array to file using Java - separate lines

前端 未结 5 672
不知归路
不知归路 2020-12-12 07:06

I\'m writing a program that writes sets of observations in the form of a String array (from User input) to file. I am able to write an observation to a .txt file and then ad

5条回答
  •  被撕碎了的回忆
    2020-12-12 07:19

    Sorry I can't comment Brian Agnew's answer because of my reputation, so I write it here.

    Seems you never have any spaces in your array items, so you can successfully use them as a separators in your .txt file. When reading, just read the file line by line and separate items by split(" ") method.

提交回复
热议问题