Java - Why File.createTempFile() does physically create an empty file on the hard drive?

By xngo on June 23, 2019

Why File.createTempFile() does physically create an empty file on the hard drive? To reserve the filename as being unique. Otherwise, there is a possibility that another file with the same name could be created by another process.

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.