-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathFilehandeling.java
More file actions
30 lines (28 loc) · 982 Bytes
/
Filehandeling.java
File metadata and controls
30 lines (28 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package filehandeling;
/**
*
* @author dcr007
*/
public class Filehandeling {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
java.io.File file = new java.io.File("drawing.png");
System.out.println("Does it exist? " + file.exists());
System.out.println("Can it be read? " + file.canRead());
System.out.println("Can it be written? " + file.canWrite());
System.out.println("Is it a directory? " + file.isDirectory());
System.out.println("Is it a file? " + file.isFile());
System.out.println("Is it absolute? " + file.isAbsolute());
System.out.println("Is it hidden? " + file.isHidden());
System.out.println("Absolute path is " +
file.getAbsolutePath());
System.out.println("Last modified on " +
new java.util.Date(file.lastModified()));
}
}