Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.File;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        try {
            File file = new File("myfile.txt");
            if (file.createNewFile())
                System.out.println("Success!");
            else
                System.out.println("Error, file already exists.");
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}