Answer:
try {
processor.process();
} catch (NumberFormatException nfe) {
System.out.println("Bad Data");
} catch (FileNotFoundException fnfe) {
System.out.println("Data File Missing");
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
Step-by-step explanation:
The first statement invokes the process() method. Here process() is the method name and processor is the name of the object.
try catch statement here is used to catch given exceptions in different catch blocks. When any of these exceptions occur in try block, the corresponding catch block is executed. This catch block is used to handle that particular exception.
In the above chunk of code, if the exception NumberFormatException is thrown then the message "Bad Data" is displayed in output. The System.out.println() is used to display the message on the output screen. Similarly when the exception FileNotFoundException is thrown the message "Data File Missing" is printed. The last catch Exception is used when any other exception is thrown and the getMessage() method is called to get the associated message and System.out.println here is used to print that associated message according to the thrown exception.