Java program File handling create operation

March 29, 2022 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp
Program for create operation in file handling:

package com.journaldev.files;
import java.io.File;
import java.io.IOException;
public class FileHandling {
      public static void main(String[] args) throws IOException {
               File file = new File(“profjayesh.txt”);
                         boolean createNewFile = file.createNewFile();
                         System.out.println(“File Created = “+createNewFile);
               }
      }
OUTPUT:

File Created = true

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion