Forward slash or backslash?

前端 未结 4 2137
谎友^
谎友^ 2020-11-27 20:55

I am looking to write and read text files to and from (respectively) a directory different from that of my program. When I specify a directory to write to or read from, shou

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 21:49

    Using forward slashes will make it system independent. I'd stick to that for simplicity.

    Consider using java.io.File.separator if you ever display the path to the user. You'd rather not surprise those Windows users. They're a jumpy lot.

提交回复
热议问题