Reading a file

Report a typo

The following code invokes a method named readFile. The method throws an IllegalArgumentException if the input string is null or empty (""). It also throws an IOException in case the file is not found or the application has no permission to read the file.

What does the following code output?

String filename = "";
try {
    readFile(filename);
} catch (NumberFormatException e) {
    System.out.println("FormatException");
} catch (IOException e) {
    System.out.println("IOException");
} catch (Exception e) {
    System.out.println("Exception");
}
Select one option from the list
___

Create a free account to access the full topic