Question
1. Create a file using any word-processing program or text editor. Write an application that displays the files name, containing folder, size, and time of
1. Create a file using any word-processing program or text editor. Write an application that displays the files name, containing folder, size, and time of last modification. Save the file as FileStatistics.java.
Below is a shell I have
1 import java.nio.file.*; 2 import java.nio.file.attribute.*; 3 import java.io.IOException; 4 public class FileStatistics 5 { 6 public static void main(String[] args) 7 { 8 Path file = 9 Paths.get("C:\\Java\\Chapter.13\\TestData.txt"); 10 try 11 { 12 // declare count and then display path, file name and folder name 13 14 15 16 // declare a BasicFileAttributes object, then add statements to display the file's size and creation time 17 18 } 19 20 catch(IOException e) 21 { 22 // add display IOException 23 24 } 25 }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started