Skip to content

Instantly share code, notes, and snippets.

@sachin-handiekar
Created June 21, 2015 09:58
Show Gist options
  • Select an option

  • Save sachin-handiekar/3fae7beb2da387ab0ad9 to your computer and use it in GitHub Desktop.

Select an option

Save sachin-handiekar/3fae7beb2da387ab0ad9 to your computer and use it in GitHub Desktop.
Create temporary file in Java
package com.javaee.insight;
import java.io.File;
import java.io.IOException;
public class CreateTempFileTest {
public static void main(String[] args) {
try {
// create a temp file
File temp = File.createTempFile("sample", ".tmp");
System.out.println("Temp file : " + temp.getAbsolutePath());
} catch (IOException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment