I was just reading some java book and making some small programs for practice, I created a small code to get information about the path I entered, and the code is:
This is not really a java question, but a windows/dos question.
The explanation comes down to the old dos command for switching drives.
Typing a drive letter followed by a colon is a command to change drives in dos, therefore the 'command' C:
does nothing since your working dir is already on the C drive. The 'directory' returned by the native interface to the JRE is the same as if you used the path "", ie your working directory.
On the other hand, add a slash and it is a proper path, to the root of your C drive, therefore your JRE is given this directory by the native interface.
If you go to a dos command (windows>run>cmd) and type in C:
you will see that it accepts the command but does not change directory, unless of course you are currently on a different drive at the time.
hope that helps.