Return | Method | Summary |
---|---|---|
boolean | isDirectory() | Tests whether the file denoted by this abstract pathname is a directory. |
boolean | isFile() | Tests whether the file denoted by this abstract pathname is a normal file. |
import java.io.File;
public class Main {
public static void main(String[] args) {
File aFile = new File("c:/");
System.out.println(aFile.isFile());
System.out.println(aFile.isDirectory());
}
}
The output:
false
true
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |