Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) throws Exception {

        Path path = Paths.get("C:/tutorial/Java/JavaFX", "Topic.txt");

        //extract a single attribute with getAttribute
        try {
            long size = (Long) Files.getAttribute(path, "basic:size", java.nio.file.LinkOption.NOFOLLOW_LINKS);
            System.out.println("Size: " + size);
        } catch (IOException e) {
            System.err.println(e);
        }

    }
}