in File Class
public static final String separator = "" + separatorChar;
where separatorChar is The system-dependent default name-separator character. This field is
initialized to contain the first character of the value of the system
property file.separator
. On UNIX systems the value of this
field is '/'
; on Microsoft Windows systems it is '\'
.
and the separatorChar created from
static private FileSystem fs = FileSystem.getFileSystem();
public static final char separatorChar = fs.getSeparator();
For you based on your operating system the separator will be changed, while using File.separator.
by using /
in your code, it won't support for other OS.