File.separator vs Slash in Paths
<p>What is the difference between using <code>File.separator</code> and a normal <code>/</code> in a Java Path-String?</p>

<p>In contrast to double backslash <code>\\</code> platform independence seems not to be the reason, since both versions work under Windows and Unix (please correct me if I am wrong here).</p>

<pre><code>public class SlashTest {
 @Test
 public void slash() throws Exception {
  File file = new File("src/trials/SlashTest.java");
  assertThat(file.exists(), is(true));
 }

 @Test
 public void separator() throws Exception {
  File file = new File("src" + File.separator + "trials" + File.separator + "SlashTest.java");
  assertThat(file.exists(), is(true));
 }
}
</code></pre>

<p>To rephrase the question, if <code>/</code> works on Unix and Windows, why should one ever use want to use <code>File.separator</code>.</p>

<p>Thank you.</p>
