How can I use java to determine whether a file with the same name already exists before creating a file?

many answers on the Internet are
File file=new File (path);
if (file.exists ()) {
file.delete ();
}
) first create a file and then determine whether the file exists. Now my question is how to determine whether the file exists on the hard drive before creating a file?

Mar.05,2021

File file=new File(path);

does not create a file, just creates a file object

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38803-344cb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38803-344cb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?