If a method writes to a file it should start out like (fill out the blank, what should you write after the parameters in the method header?): accessor returnValue methodName ( parameters ) __________________

Respuesta :

Answer:

accessor returnValue methodName ( parameters ) throws IOException;

Explanation:

If a method writes to a file then it may potentially encounter Input-Output related exception during the execution. In order to handle this scenario the function signature should include the throws clause. So the method signature should be as follows:

accessor returnValue methodName ( parameters ) throws IOException;

For example, if the method is called writeToFile , its signature can be of the form:

public void writeToFile(String data) throws IOException;