Java File.separator或File.pathSeparator
在File该类中,有两个字符串,separator和pathSeparator。
有什么不同?我什么时候应该使用另一个?
回答:
如果你的意思是File.separator和File.pathSeparator则:
File.pathSeparator用于在文件路径列表中分隔各个文件路径。考虑在Windows上的PATH环境变量。你使用a ;分隔文件路径,因此在Windows File.pathSeparator上将是;。File.separator是/或\用于将路径拆分到特定文件。例如在Windows上,\或C:\Documents\Test
以上是 Java File.separator或File.pathSeparator 的全部内容, 来源链接: utcz.com/qa/416746.html
