The latter file is created in the default temporary file directory and is not in the current directory
createNewFile
public boolean createNewFile()
throws IOException Indivisibly creates a new, empty file if and only if a file with the name specified by this abstract pathname does not exist. Checking whether a file exists and creating it if it does not exist is a single operation that is inseparable from all other file system activities that may affect the file.
createTempFile
public static File createTempFile(String prefix,
String suffix)
throws IOException creates a temporary file in the default directory Empty file, whose name is generated using the given prefix and suffix. Calling this method is equivalent to calling createTempFile(prefix, suffix, null).
Parameters:
prefix - the prefix string used to generate the file name; must be at least three characters long
suffix - the suffix used to generate the file name String; can be null, in which case the suffix ".tmp" will be used
Returns:
The abstract pathname representing a new empty file