3. |
What is wrong with the following code? Assume that the class MyFileObject is a valid class that is capable of representing a file in the file system, whose constructor takes a String indicating the file name and does not throw an exception, and that defines the methods open() and close(), and that open() might throw an IOException.
MyFileObject obj = new MyFileObject("test.in");
try {
obj.open();
} catch(IOException) {
System.out.println("an error occurred");
}
finally {
obj.close();
}
Please select the best answer.
|