This Java tip demonstrates a method of creating a temporary file. The developer may use this temporary file to copy the content or various information which may be required again during the execution of the application. This increases the efficiency of the application.

try {

        // Create temporary file.
        File tempfile = File.createTempFile("name", ".ext");
        // Delete temp file when program exits.
        // Write to temp file
        BufferedWriter out = new BufferedWriter(new FileWriter(tempfile));

    } catch (IOException e) {