How to create temporary files in java

The follwoing explains about , how to create temporary file


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

public class CreateTempFileExample
{
public static void main(String[] args)
{

try{

//create a temp file
File temp = File.createTempFile("temporaryfile", ".tmp");

System.out.println("Temp file : " + temp.getAbsolutePath());

}catch(IOException e){

e.printStackTrace();

}

}
}

 

SHARE

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment