Path separator:
Under Windows it is "/"
unix|linux is "/"
Considering the portability of the program, it is recommended that you use "/" when creating files. After testing, it is also possible to use "/" under the Windows platform when creating files with Java. Java seems to have been processed in the background.
There is another usage:
Replace them with File.separator and this one will never have portability issues.
Here are some examples to deepen your understanding:
File f = new File("d://book//1"); √
File f = new File("d:/book/1");√
File f = new File("d://book//1");√
File f = new File("d:/book/1"); Χ
Note: / is an escape character, so // is equivalent to /.
Summary: It is recommended that you use "/" or "File.separator".