Handling File Existence in Java

Report a typo

Given the Java code below, what can be the expected outcome? Choose the correct answer(s).

File file = new File("Example.txt");
if (file.exists()) {
   System.out.println(file.getName() + " exists");
   file.delete();
} else {
   System.out.println("File not found");
}
Select one or more options from the list
___

Create a free account to access the full topic