doubt in file path
i tried a program comparing C:\Program Files and C://Program Files i checked with compareTo()==0 it comes they are equal. But i doubt if there is any difference between //&\ Is t开发者_如何学Gohere any difference? what is the difference between c:/program files and //?
There is no difference, at least in Sun's implementation. The Win32FileSystem
normalizes paths by converting slashes and removing duplicate slashes.
If you want to be 100% portable, use File.separator
The separator between path components depends on operating system. Java represents file path independently of operating system and that causes equality of values considered. Conversion to native representation is done on lower level (as Bozho pointed out), and you should not worry about that. Nevertheless I'd recommend using "/" as separator, as it is more common OS-wise.
精彩评论