I am trying to create a temporary files using java.But when i run my codes it shows the following error.
number.java:7: cannot find symbol
symbol : class Path
location: class number
Path tempFile = Files.createTempFile(null, ".txt");
^
number.java:7: cannot find symbol
symbol : method createTempFile(<nulltype>,java.lang.String)
location: class Files
Path tempFile = Files.createTempFile(null, ".txt");
^
2 errors
and here's the code and when i import java.io.file;.then it show error package does not exist
import java.io.*;
public class number{
public static void main(String args[])
{try {
Path tempFile = Files.createTempFile(null, ".txt");
System.out.format("The temporary file" +
" has been created: %s%n", tempFile);
} catch (IOException x) {
System.err.format("IOException: %s%n", x);
}
}}