-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFileStatistics.java
More file actions
38 lines (33 loc) · 941 Bytes
/
Copy pathFileStatistics.java
File metadata and controls
38 lines (33 loc) · 941 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
31
32
33
34
35
36
37
38
// Programmer: Edgar Colin
// Student ID: EDG2140344
// Class: CIS263AA JAVA II Class # 12303
// Instructor: Michael Parmeley
// Chapter: 13
// Problem: 1
// Part:
// Filename: FileStatistics1.java
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.IOException;
public class FileStatistics
{
public static void main(String[] args)
{
String Filename = "Chapter13_Exercise1.txt";
Path filePath =
Paths.get(Filename);
try
{
BasicFileAttributes attr =
Files.readAttributes(filePath, BasicFileAttributes.class);
System.out.println("File name: " + Filename);
System.out.println("Size " + attr.size());
System.out.println("Last modified time " +
attr.lastModifiedTime());
}
catch(IOException e)
{
System.out.println("IO Exception");
}
}
}