Difference between C: and C:/

java, windows

Solution

`C:` means "whatever directory is currently selected on drive `C:`". In your case, it's probably the directory that your application is running from.

`D:` is the same as `D:/` in your case because the root directory is the current working directory in `D:`.

Problem

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: ``` String path = JOptionPane.showInputDialog("Enter Path to analyze"); File file = new File(path); if (file.exists()) { String result = ""; if (file.isDirectory()) { result += "Path is directory\n "; String [] resList = file.list(); for (String s : resList) { result += s + ", "; } } if (file.isFile()) { result += "Path is a file\n"; } JOptionPane.showMessageDialog(null, result); ``` Now in the input dialogue, when I enter `C:`, the result is `build, build.xml, manifest.mf, nbproject, src`, but when I enter C:/, it shows the complete list of directories and files in C. And strangely it does not happen with the D drive and other drives (i.e. the result is same for D:/ and D:), what is happening please explain? Update Same happens in WPF using C#!

Original source