nerdexam
Oracle

1Z0-805 · Question #55

Given the code fragment: public void processFile() throws IOException, ClassNotFoundException { try (FileReader fr = new FileReader ("logfilesrc.txt"); FileWriter fw = new FileWriter…

The correct answer is A. java.io.IOException. See the full explanation below for the reasoning.

Question

Given the code fragment:

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"); } } 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?

Options

  • Ajava.io.IOException
  • Bjava.lang.Exception
  • Cjava.lang.ClassNotException
  • Djava.lang.NoSuchClassException

How the community answered

(20 responses)
  • A
    80% (16)
  • B
    5% (1)
  • C
    5% (1)
  • D
    10% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-805 Practice