FileSystem getSeparator() method in Java with Examples Last Updated : 02 Aug, 2021 Comments Improve Suggest changes Like Article Like Report The getSeparator() method of a FileSystem class is used to return the name separator for this file system as a string. The name separator is used to separate names in a path string. In the case of the default provider, this method returns the same separator as String.Syntax: public abstract String getSeparator() Parameters: This method accepts nothing.Return value: This method returns the same separator as String.Below programs illustrate the getSeparator() method: Program 1: Java // Java program to demonstrate // FileSystem.getSeparator() method import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.Paths; public class GFG { public static void main(String[] args) { // create the object of Path Path path = Paths.get( "C:\\Movies\\document.txt"); // get FileSystem object FileSystem fs = path.getFileSystem(); // apply getSeparator() methods String separator = fs.getSeparator(); // print System.out.println("Separator: " + separator); } } Output: Program 2: Java // Java program to demonstrate // FileSystem.getSeparator() method import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.Paths; public class GFG { public static void main(String[] args) { // create the object of Path Path path = Paths.get( "E:// Tutorials// file.txt"); // get FileSystem object FileSystem fs = path.getFileSystem(); // apply getSeparator() methods String separator = fs.getSeparator(); // print System.out.println("File Separator: " + separator); } } Output: References: https://docs.oracle.com/javase/10/docs/api/java/nio/file/FileSystem.html#getSeparator() Comment More infoAdvertise with us Next Article FileSystem getSeparator() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.nio.file package Java-FileSystem Practice Tags : Java Similar Reads Files getFileStore() method in Java with Examples getFileStore() method of java.nio.file.Files help us to return the FileStore object which represents the file store where a file is located. Once you get a reference to the FileStore you can apply filestore type of operation to get information of filestore. Syntax: public static FileStore getFileSto 2 min read FileSystem getRootDirectories() method in Java with Examples The getRootDirectories() method of a FileSystem class is used to return an Iterator object to iterate over the paths of the root directories for this File System. A file system is composed of a number of distinct file hierarchies, each with its own top-level root directory and each element in the re 2 min read FileStore getUsableSpace() method in Java with Examples The getUsableSpace() method of a FileStore class is used to return the number of bytes available to this Java virtual machine on the file store. This method is useful to check free space. This method returns the available usable space as a long value. Syntax: public abstract long getUsableSpace() th 2 min read FileStore getTotalSpace() method in Java with Examples The getTotalSpace() method of a FileStore class is used to return total size of the file store, in bytes. This method returns this total size as a long value. Syntax: public abstract long getTotalSpace() throws IOException Parameters: This method accepts nothing. Return value: This method returns th 2 min read FileSystem isOpen() method in Java with Examples The isOpen() method of a FileSystem class is used to return true if file system is open. This method is very helpful to know filesystem is open or not. File systems created by the default provider are always open. Syntax: public abstract boolean isOpen() Parameters: This method accepts nothing. Retu 2 min read Like