If exception occur when closing the FileWriter object and when retrieving the JString class object, which exception object is thrown to the caller of the processFile method?

Given the code fragment:
<code>
public void processFile() throws IOException, ClassNotFoundException {
try (FileReader fr = new FileReader (“logfilesrc.txt”);
FileWriter fw = new FileWriter (“logfiledest.txt”)) {
Class c = Class.forName (“java.lang.JString”);
}
}
</code>
If exception occur when closing the FileWriter object and when retrieving the JString class object, which exception object is thrown to the caller of the processFile method?

Given the code fragment:
<code>
public void processFile() throws IOException, ClassNotFoundException {
try (FileReader fr = new FileReader (“logfilesrc.txt”);
FileWriter fw = new FileWriter (“logfiledest.txt”)) {
Class c = Class.forName (“java.lang.JString”);
}
}
</code>
If exception occur when closing the FileWriter object and when retrieving the JString class object, which exception object is thrown to the caller of the processFile method?

A.
java.io.IOException

B.
java.lang.Exception

C.
java.lang.ClassNotException

D.
java.lang.NoSuchClassException



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Marian

Marian

ClassNotFoundException