How do I check if a file exists in Java and then delete that file

Updated:13/feb/2020 by Computer Hope

Here we are Showing details of file like
last modification , size of file and File is exist or not

import java.util.*;
class ExampleFileInfo
	public static void main(String args[]) 
    //Showing details of file like 
    //last modification , size of file , File is exist or not
    File myfile=new File("D:/Assignments/message.txt");
    System.out.println("Size of file is "+myfile.length());
    System.out.println("File was mod on "+myfile.lastModified());
    Date today=new Date(myfile.lastModified());
    System.out.println("The above time is "+today);