Home>Article>Java> Java determines whether it is a folder

Java determines whether it is a folder

尚
Original
2019-11-20 15:58:54 2978browse

Java is an object-oriented programming language. It not only absorbs the various advantages of the C language, but also abandons the difficult-to-understand concepts such as multiple inheritance and pointers in C. Therefore, the Java language has two characteristics: powerful functions and simple and easy to use. .

Java determines whether it is a folder

isDirectory() in java checks whether an object is a folder. The return value is of type boolean. Returns true if so, false otherwise.

The calling method is: object.isDirectory() without specifying parameters.

Example:

String path="C:/windows/Help"; //我随便给的一个目录 File f=new File(path); //new的一个File对象 if(f.isDirectory()){ //如果path表示的是一个目录则返回true .... }

For more java knowledge, please pay attention tojava basic tutorial.

The above is the detailed content of Java determines whether it is a folder. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn