Question: Methods can return values to communicate failure or success or to update local objects or fields. Security risks can arise when method return values are
Methods can return values to communicate failure or success or to update local objects or fields. Security risks can arise when method return values are ignored or when the invoking method fails to take suitable action. Consequently, programs must not ignore method return values. This code example attempts to delete a file but fails to check whether the operation has succeeded. Modify the code to appropriately handle method return values.

public void deleteFile(){ File some File = new File("someFileName.txt"); // Do something with someFile someFile.delete(); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
