nerdexam
Oracle

1Z0-804 · Question #52

Given the code fragment: If the file userguide.txt does not exist, what is the result?

The correct answer is E. Compilation fails. Compilation fails : Exception Exception is not compatible with throws clause in Base.process() IOExceptiondie Exception in der Derived Class Methode muss zur Base Class Methode passen.

Java I/O Fundamentals

Question

Given the code fragment:

If the file userguide.txt does not exist, what is the result?

Exhibit

1Z0-804 question #52 exhibit

Options

  • AAn empty file iscreated and success is printed
  • Bclass java.io.FileNotFoundException
  • Cclass java.io.IOException
  • Dclass java.lang.Exception
  • ECompilation fails

How the community answered

(60 responses)
  • A
    3% (2)
  • B
    2% (1)
  • C
    10% (6)
  • D
    5% (3)
  • E
    80% (48)

Explanation

Compilation fails : Exception Exception is not compatible with throws clause in Base.process() IOExceptiondie Exception in der Derived Class Methode muss zur Base Class Methode passen.

Topics

#BufferedReader#FileReader#checked exception#compilation

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice