Conditions of using the list method in the file class

Source: Internet
Author: User

After a directory is specified, you want to use the list method to list all file names in the directory. If there are no files in the directory, subsequent operations are not allowed. At first, I mistakenly thought that the list method would return a null value when there is no file in the path. As a result, no correct result is obtained according to this idea, the output return value indicates that no file value in the path is null. After viewing the help documentation, I learned that a null value is returned only when the given string does not represent a path or an input/output error occurs. Therefore, the objective is to determine the length of the returned value (String Array.

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.