try {
    File file = new File("filename");

    // Create file if it does not exist
    boolean success = file.createNewFile();
    if (success) {
        // File did not exist and was created
    } else {
        // File already exists
} catch (IOException e) {

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.