![]() } Output Enter the path to create a directory:Įnter the name of the desired a directory: ("Sorry couldn’t create specified directory") ("Enter the name of the desired a directory: ") ("Enter the path to create a directory: ") Invoke the mkdir() method using the above created file object.įollowing Java example reads the path and name of the directory to be created, from the user, and creates it.Instantiate the File class by passing the path of the directory you need to create, as a parameter (String).The mkdir() method of this class creates a directory with the path represented by the current object. This class provides various methods to perform various operations on files/directories. ![]() The class named File of the java.io package represents a file or directory (path names) in the system.
0 Comments
Leave a Reply. |