Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Java Create a file using any word processing program or text editor. Write an

ID: 3629938 • Letter: I

Question

In Java
Create a file using any word processing program or text editor.

Write an application that displays the file's name, containing

folder size and time of last modification.
Save as FileStatistics
This is what I have with errors, am i going down the right path?
Thanks
<code>

import java.nio.file.*;
import java.io.*;
import java.nio.file.attribute.*;
import java.util.Scanner;

public class FileStatistics
{
private static Object Attributes;
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
String filename;
System.out.print("Enter name of file to use>>");
filename = kb.nextLine();
String fileName = "C:\Java\FileStatistics.txt";
Path file = Paths.get(fileName);

Paths.get("C:\Java\FileStatistics.txt");
String s = "ABCDF";
byte[] data = s.getBytes();
OutputStream output = null;
try
{

}
catch(Exception e)
{
System.out.println("Message: " + e);
}
try
{
BasicFileAttributes attr =
getAttributes().readBasicFileAttributes(file);
System.out.println(" Attributes(file");
System.out.println("Creation Time " + attr.creationTime

());
System.out.println("Size" + attr.size());
}
catch(IOException e)
{
System.out.println("IO Exception e");

}
}

/**
* @return the Attributes
*/
public static Object getAttributes() {
return Attributes;
}

/**
* @param aAttributes the Attributes to set
*/
public static void setAttributes(Object aAttributes) {
Attributes = aAttributes;
}
}
<code>

Explanation / Answer

Yes every thing fine in the code. But you should download jar file for java.nio and need to add for classpath

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote