FileStore name() method in Java with Examples Last Updated : 03 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The name() method of a FileStore class is used to return the name of this file store as a String. The format of the name is typically the name of the storage pool or volume. The string returned by this method may differ from the string returned by the toString() method. Syntax: public abstract String name() Parameters: This method accepts nothing. Return value: This method returns the name of this file store as a String. Below programs illustrate the name() method: Program 1: Java // Java program to demonstrate FileStore.name() method import java.io.IOException; import java.nio.file.FileStore; import java.nio.file.Files; 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 FileStore object try { FileStore fs = Files.getFileStore(path); // print FileStore name System.out.println("FileStore Name: " + fs.name()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Output: Program 2: Java // Java program to demonstrate FileStore.name() method import java.io.IOException; import java.nio.file.FileStore; import java.nio.file.Files; 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\\001.txt"); // get FileStore object try { FileStore fs = Files.getFileStore(path); // print FileStore name and Total usable space String name = fs.name(); System.out.println("FileStore Name: " + name); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Output: References: https://docs.oracle.com/javase/10/docs/api/java/nio/file/FileStore.html#name() Comment More infoAdvertise with us Next Article FileStore name() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.nio.file package Java-FileStore Practice Tags : Java Similar Reads FileStore type() method in Java with Examples The type() method of a FileStore class is used to return the type of this file store and the format of the returned string highly implementation-specific. Syntax:Â public abstract String type()Parameters: This method accepts nothing. Return value: This method returns a string representing the type o 2 min read File renameTo() method in Java with examples The renameTo() method is a part of File class. The renameTo() function is used to rename the abstract path name of a File to a given path name. The function returns true if the file is renamed else returns false Function Signature: public boolean renameTo(File destination) Syntax: file.renameTo(File 2 min read Files size() method in Java with Examples size() method of java.nio.file.Files help us to get the size of a file (in bytes). This method returns the file size, in bytes by taking the path of the file as a parameter. The size may differ from the actual size on the file system due to compression, support for sparse files, or other reasons. Th 2 min read File mkdir() method in Java with examples The mkdir() method is a part of File class. The mkdir() function is used to create a new directory denoted by the abstract pathname. The function returns true if directory is created else returns false. Function Signature: public boolean mkdir() Syntax: file.mkdir() Parameters: This method do not ac 2 min read Path getFileSystem() method in Java with Examples The Path interface was added to Java NIO in Java 7. The Path interface is located in the java.nio.file package, so the fully qualified name of the Java Path interface is java.nio.file.Path. A Java Path instance represents a path in the file system. A path can use to locate either a file or a directo 2 min read Like