Skip to content

Instantly share code, notes, and snippets.

@sachin-handiekar
Created August 26, 2013 15:13
Show Gist options
  • Save sachin-handiekar/6342530 to your computer and use it in GitHub Desktop.
Save sachin-handiekar/6342530 to your computer and use it in GitHub Desktop.
Creating a 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