Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.File;
import java.io.FileFilter;

public class Main {
    public static void main(String[] args) {

        File f = new File("c:/test");

        FileFilter filter = new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.isFile();
            }
        };

        // returns pathnames for files and directory
        File[] paths = f.listFiles(filter);

        for (File path : paths) {
            System.out.println(path);
        }
    }
}