Difference between File.separator and slash in paths

后端 未结 14 1219
执笔经年
执笔经年 2020-11-22 13:15

What is the difference between using File.separator and a normal / in a Java Path-String?

In contrast to double backslash \\\\

14条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 13:25

    You use File.separator because someday your program might run on a platform developed in a far-off land, a land of strange things and stranger people, where horses cry and cows operate all the elevators. In this land, people have traditionally used the ":" character as a file separator, and so dutifully the JVM obeys their wishes.

提交回复
热议问题