Java File create temporary file

Description

Java File create temporary file

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

public class Main {
  public static void main(String[] args) {
    try {//  www .jav  a2  s.c o  m
      File tempFile = File.createTempFile("FileName", ".txt");
      boolean fileCreated = tempFile.exists();
      System.out.println(fileCreated);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}



PreviousNext

Related