forked from Joyounger/Introduction-to-Java-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestFileClass.java
More file actions
22 lines (18 loc) · 723 Bytes
/
TestFileClass.java
File metadata and controls
22 lines (18 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// date:17.4.2
// author: linyang <linyang@xiaomi.com>
import java.io.File;
import static java.lang.System.out;
public class TestFileClass {
public static void main(String[] args) {
File file = new File("image/us.gif");
out.println("dose it exist? " + file.exists());
out.println("can it be read? " + file.canRead());
out.println("can it be written? " + file.canWrite());
out.println("is it a direcotry? " + file.isDirectory());
out.println("is it a file? " + file.isFile());
out.println("is it absolute? " + file.isAbsolute());
out.println("is it hidden? " + file.isHidden());
out.println("absolute path is? " + file.getAbsolutePath());
out.println("last modified on " + file.lastModified());
}
}