In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to create File class". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to create File class.
Overview
File is the only path in the IO package that represents files and disk directories. Includes creating, deleting, renaming, getting file information, etc. However, File cannot access the contents of the file itself. If you need to access the contents of the file itself, you need to use the input / output stream.
Constructor File (String pathname)
Create a File object with pathname as the path, either an absolute path or a relative path, and if pathname is a relative path, the default current path is stored in the system property user.dir.
File (String parent,String child)
Create a File object with parent as the parent path and child as the child path.
File (File parent,String child)
Get objects from parent File objects and child files / directories
Path separator
Each level of directory in the path is separated by a path separator.
Create public boolean createNewFile (): create a file. If the file exists, do not create it, return false public boolean mkdir (): create the file directory. If this file directory exists, it will not be created. If the upper directory of this file directory does not exist, it will not be created. public boolean mkdirs (): creates a file directory. If the upper file directory does not exist Create file path File getAbsoluteFile (): get absolute path String getAbsolutePath (): get absolute path String getPath (): get file path String getName (): get file name File getParentFile (): get parent directory file String getParent (): get parent directory path file attribute boolean canExecute (): determine whether it is an executable file boolean canRead (): determine whether the file is readable boolean canWrite ( ): determine whether the file is writable boolean isHidden (): determine whether the file is hidden long lastModified (): determine the last modification time of the file. Thank you for reading. The above is the content of "how to create the File class". After the study of this article, I believe you have a deeper understanding of how to create the File class, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.