It creates a folder in the same way as the mkdir() method, but it also creates the parent folders too that do not exist. The mkdirs() method creates a hierarchy of new folders or directories. The mkdirs() method is more powerful than mkdir() method. The drawback of the mkdir() method is resolved by the mkdirs() method. If we go to that location, we will see the created folder as: Note: If we enter an unavailable path, the mkdir() method will not create a folder and pass the control flow to the else part. ("Enter the name of the desired a directory: ") Using Scanner class to get the folder name from the user ![]() ![]() ("Enter the path where you want to create a folder: ") Using Scanner class to get the path from the user where he wants to create a folder.
0 Comments
Leave a Reply. |