开发者

How do I specifiy a path to a file in Java?

Ok this is a homework questions, but I cannot fi开发者_如何学Gond the answer anywhere, not even in the book.

Path to Files If the user wants to specify a path for a file, the typical forward slash is replaced by __________________.

can you help?


Try using double back-slashes. (\\)

However, the more portable solution is to use File.separator, as described here.


By the way, "/" works on all platforms.


Use File.separator.


This depends on the platform - on windows, it'll be replaced by 'c:\', on Unix it'll be left as '/'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜