Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.File;

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

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

        // true if the file path is a file, else false
        boolean bool = f.isFile();

        // get the path
        String path = f.getPath();

        System.out.println(path + " is file? " + bool);

        // create new file
        f = new File("c:/test.txt");

        // true if the file path is a file, else false
        bool = f.isFile();

        // get the path
        path = f.getPath();

        System.out.print(path + " is file? " + bool);

    }
}