Lets check on existing file on hdd using Java

Lets run next code for this:


File myFile = new File("C:\\myFyle.txt");

if(myFile.exists()){
System.out.println("Yes");
}else{
System.out.println("No");
}

Result: depends on existing Yes or No