Horse Soldier Java Tutorial Note 4

Source: Internet
Author: User

File class

Java.io.File class represents system file name

Common construction methods for the file class:

The public file (String pathname) creates a file object with pathname as the path, and if pathname is a relative path, the default current path in the system property

Public file (string parent, String child) takes the parent path to the father, and children creates a File object for the subpath

The static property of file, string separator, stores the path delimiter for the current system

File Common methods

The file object can access the properties of the files

public boolean canRead ();

public boolean canWrite ();

public boolean exists ();

public boolean isdirctory ();

public boolean isfile ();

public boolean Ishidden ();

Public long lastmodified ();//Last Modified time

public long length ();

Public String getName ();

Public String GetPath ();

Create an empty file or directory from the file object (in the case where the object refers to a document or directory that does not exist)

public Boolean creatnewfile () throws IOException

public Boolean Delete ()

Public Booean mkdir ();

public boolean mkdirs ();

Horse Soldier Java Tutorial Note 4

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.