Tutorialspoint examples

Learn java tutorial with examples for beginners online

create temporary file java program


Example:

package com.tutorialspointexamples;
 
import java.io.File;
 
public class TempFileTest {
  public static void main(String args[]){
	  File tempFile = null;
      try {
          tempFile = File.createTempFile("TempFile", ".tmp");
          System.out.println("Created Temp File Location : " 
          + tempFile.getAbsolutePath());
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
}

Output:

Created Temp File Location : C:\Users\jai\AppData\Local\Temp\TempFile8937817865485312925.tmp

Download this example.

Download tutorialspointexamples Android App
Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status