Using file seperators in java

In a real world examples we will use File separators instead of providing backslashes like we used in many examples to define a path

Just for testing we can print the File separators used in windows lik this

   String separator = File.separator;
   System.out.println(separator);
   separator = FileSystems.getDefault().getSeparator();
   System.out.println(separator);

We can use File.separator To create a directory path like below

   Path directory =  FileSystems.getDefault().getPath("FilesTree"+File.separator+"Dir2");