|
|||||||
Directories in Java
Время создания: 05.09.2017 11:15
Текстовые метки: code
Раздел: Java - Tutorial - Directories
Запись: xintrea/mytetra_db_mcold/master/base/1504597884bl7qfwitrq/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
Directories in Java A directory is a File which can contain a list of other files and directories. You use File object to create directories, to list down files available in a directory. For complete detail, check a list of all the methods which you can call on File object and what are related to directories. Creating Directories There are two useful File utility methods, which can be used to create directories −
Following example creates "/tmp/user/java/bin" directory − Example import java.io.File; public class CreateDir { public static void main(String args[]) { String dirname = "/tmp/user/java/bin"; File d = new File(dirname);
// Create directory now. d.mkdirs(); } }
Compile and execute the above code to create "/tmp/user/java/bin". Note − Java automatically takes care of path separators on UNIX and Windows as per conventions. If you use a forward slash (/) on a Windows version of Java, the path will still resolve correctly. |
|||||||
Так же в этом разделе:
|
|||||||
|
|||||||
|